2025-03-01 10:55:52 +08:00
|
|
|
|
unit U_BSPrtInEdit;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|
|
|
|
|
cxEdit, DB, cxDBData, cxCalendar, cxDropDownEdit, ComCtrls, ToolWin,
|
|
|
|
|
|
cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|
|
|
|
|
cxClasses, cxControls, cxGridCustomView, cxGrid, cxGridCustomPopupMenu,
|
|
|
|
|
|
cxGridPopupMenu, ADODB, DBClient, cxButtonEdit, cxTextEdit, StdCtrls, ExtCtrls,
|
|
|
|
|
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxDateRanges,
|
|
|
|
|
|
dxBarBuiltInMenu, U_BaseInput, System.ImageList, Vcl.ImgList, dxSkinsCore,
|
|
|
|
|
|
dxSkinsDefaultPainters, dxScrollbarAnnotations, cxImageList;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfrmBSPrtInEdit = class(TfrmBaseInput)
|
|
|
|
|
|
cxGrid1: TcxGrid;
|
|
|
|
|
|
Tv1: TcxGridDBTableView;
|
|
|
|
|
|
v1Column2: TcxGridDBColumn;
|
|
|
|
|
|
v1SPName: TcxGridDBColumn;
|
|
|
|
|
|
v2Column6: TcxGridDBColumn;
|
|
|
|
|
|
cxGrid1Level1: TcxGridLevel;
|
|
|
|
|
|
v1Column4: TcxGridDBColumn;
|
|
|
|
|
|
DS_1: TDataSource;
|
|
|
|
|
|
CDS_Sub: TClientDataSet;
|
|
|
|
|
|
ADOQueryCmd: TADOQuery;
|
|
|
|
|
|
ADOQueryMain: TADOQuery;
|
|
|
|
|
|
ADOQueryTemp: TADOQuery;
|
|
|
|
|
|
GPM_1: TcxGridPopupMenu;
|
|
|
|
|
|
v1Column12: TcxGridDBColumn;
|
|
|
|
|
|
v1FactoryName: TcxGridDBColumn;
|
|
|
|
|
|
v1Column6: TcxGridDBColumn;
|
|
|
|
|
|
v1SPSpec: TcxGridDBColumn;
|
|
|
|
|
|
v1QtyUnit: TcxGridDBColumn;
|
|
|
|
|
|
v1Column5: TcxGridDBColumn;
|
|
|
|
|
|
v1Column1: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column1: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column2: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column3: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column4: TcxGridDBColumn;
|
2025-07-10 17:28:43 +08:00
|
|
|
|
Tv1Style: TcxGridDBColumn;
|
2025-07-15 15:06:22 +08:00
|
|
|
|
Panel1: TPanel;
|
|
|
|
|
|
ToolBar1: TToolBar;
|
|
|
|
|
|
TBSave: TToolButton;
|
|
|
|
|
|
ToolButton2: TToolButton;
|
|
|
|
|
|
TBAdd1: TToolButton;
|
|
|
|
|
|
TbAdd2: TToolButton;
|
|
|
|
|
|
TBDel: TToolButton;
|
|
|
|
|
|
ToolButton1: TToolButton;
|
|
|
|
|
|
TBClose: TToolButton;
|
|
|
|
|
|
ToolButton3: TToolButton;
|
2025-09-13 14:39:43 +08:00
|
|
|
|
Tv1FromPurSId: TcxGridDBColumn;
|
|
|
|
|
|
Tv1FromPurMId: TcxGridDBColumn;
|
2025-03-01 10:55:52 +08:00
|
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
2025-07-10 17:28:43 +08:00
|
|
|
|
procedure TBAdd1Click(Sender: TObject);
|
2025-03-01 10:55:52 +08:00
|
|
|
|
procedure TBCloseClick(Sender: TObject);
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
procedure TBDelClick(Sender: TObject);
|
|
|
|
|
|
procedure TBSaveClick(Sender: TObject);
|
|
|
|
|
|
procedure v1Column14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure Tv1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure FormDestroy(Sender: TObject);
|
|
|
|
|
|
procedure Tv1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure ToolButton1Click(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton2Click(Sender: TObject);
|
2025-07-10 17:28:43 +08:00
|
|
|
|
procedure TbAdd2Click(Sender: TObject);
|
2025-07-15 15:06:22 +08:00
|
|
|
|
procedure ToolButton3Click(Sender: TObject);
|
2025-08-24 15:16:44 +08:00
|
|
|
|
procedure v1QtyUnitPropertiesButtonClick(Sender: TObject;
|
|
|
|
|
|
AButtonIndex: Integer);
|
2025-03-01 10:55:52 +08:00
|
|
|
|
private
|
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
|
function SaveCKData(): Boolean;
|
|
|
|
|
|
public
|
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
|
FBCId, canshu3, FSTKName, FKHName: string;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
|
frmBSPrtInEdit: TfrmBSPrtInEdit;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_ProductInfoSel, U_CompanySel,
|
2025-07-15 15:06:22 +08:00
|
|
|
|
U_JWLPurchasePlanSel, U_GKManageSel, U_PurchasePlanSel;
|
2025-03-01 10:55:52 +08:00
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBSPrtInEdit.FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
Action := caFree;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-07-10 17:28:43 +08:00
|
|
|
|
procedure TfrmBSPrtInEdit.TBAdd1Click(Sender: TObject);
|
2025-03-01 10:55:52 +08:00
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmProductInfoSel := TfrmProductInfoSel.Create(Application);
|
|
|
|
|
|
with frmProductInfoSel do
|
|
|
|
|
|
begin
|
|
|
|
|
|
FSTKName := Self.FSTKName;
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Append;
|
|
|
|
|
|
FieldByName('IOTime').Value := Trim(FormatDateTime('yyyy-MM-dd', Now));
|
|
|
|
|
|
FieldByName('StkCoNo').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|
|
|
|
|
FieldByName('StkCoName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|
|
|
|
|
FieldByName('IOType').Value := '<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('P_Code').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Code').value;
|
|
|
|
|
|
FieldByName('P_Name').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Name').value;
|
|
|
|
|
|
FieldByName('P_Spec').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Spec').value;
|
|
|
|
|
|
FieldByName('Brand').Value := frmProductInfoSel.CDS_1.fieldbyname('Brand').value;
|
|
|
|
|
|
FieldByName('QtyUnit').Value := frmProductInfoSel.CDS_1.fieldbyname('QtyUnit').value;
|
|
|
|
|
|
FieldByName('Price').Value := frmProductInfoSel.CDS_1.fieldbyname('Price').value;
|
2025-07-10 17:28:43 +08:00
|
|
|
|
FieldByName('Style').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
2025-03-01 10:55:52 +08:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmProductInfoSel.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfrmBSPrtInEdit.SaveCKData(): Boolean;
|
|
|
|
|
|
var
|
|
|
|
|
|
Maxno, MBPIOID: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|
|
|
|
|
CDS_Sub.DisableControls;
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select * from BS_Product_IO where BPIOID=''' + Trim(CDS_Sub.fieldbyname('BPIOID').AsString) + '''');
|
|
|
|
|
|
open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
MBPIOID := Trim(ADOQueryTemp.fieldbyname('BPIOID').AsString);
|
|
|
|
|
|
if Trim(MBPIOID) = '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if not GetLSNo(ADOQueryCmd, Maxno, 'PR', 'BS_Product_IO', 3, 1) then
|
|
|
|
|
|
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
Maxno := Trim(MBPIOID);
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select * from BS_Product_IO where BPIOID=''' + Trim(Maxno) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Trim(MBPIOID) = '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Append;
|
|
|
|
|
|
FieldByName('Fillid').Value := Trim(Dcode);
|
|
|
|
|
|
FieldByName('Filler').Value := Trim(DName);
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('Editid').Value := Trim(Dcode);
|
|
|
|
|
|
FieldByName('Editer').Value := Trim(DName);
|
|
|
|
|
|
FieldByName('EditTime').Value := SGetServerDate(ADOQueryTemp);
|
|
|
|
|
|
end;
|
|
|
|
|
|
RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_Sub, 'BS_Product_IO', 0);
|
|
|
|
|
|
FieldByName('FromCoNo').Value := CDS_Sub.fieldbyname('FromCoNo').Value;
|
|
|
|
|
|
FieldByName('StkCoNo').Value := CDS_Sub.fieldbyname('StkCoNo').Value;
|
|
|
|
|
|
|
|
|
|
|
|
// FieldByName('FromPurNo').Value := CDS_Sub.fieldbyname('FromPurNo').Value;
|
|
|
|
|
|
// FieldByName('FromPurMId').Value := CDS_Sub.fieldbyname('FromPurMId').Value;
|
|
|
|
|
|
// FieldByName('FromPurSId').Value := CDS_Sub.fieldbyname('FromPurSId').Value;
|
|
|
|
|
|
|
|
|
|
|
|
FieldByName('BPIOID').Value := Trim(Maxno);
|
|
|
|
|
|
FieldByName('STKID').Value := Trim(Maxno);
|
|
|
|
|
|
FieldByName('STKName').Value := FSTKName;
|
|
|
|
|
|
FieldByName('IOFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('IOQtyFlag').Value := 1;
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('Update BS_Product_IO Set StkQty=(select Sum(isnull(Qty,0)*IOQtyFlag) from BS_Product_IO A where A.STKID=BS_Product_IO.BPIOID )');
|
|
|
|
|
|
sql.Add(' where BPIOID=''' + Trim(Maxno) + '''');
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select stkQty from BS_Product_IO where BPIOID=''' + Trim(Maxno) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if ADOQueryTemp.FieldByName('stkQty').Value < 0 then
|
|
|
|
|
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!');
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails)');
|
|
|
|
|
|
sql.Add('values(' + quotedstr(FSTKName + '<27><><EFBFBD><EFBFBD>'));
|
|
|
|
|
|
sql.Add(',' + quotedstr(Maxno));
|
|
|
|
|
|
sql.Add(',''<27><><EFBFBD><EFBFBD>'' ');
|
|
|
|
|
|
sql.Add(',' + quotedstr(DName));
|
|
|
|
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|
|
|
|
|
sql.Add(',' + quotedstr(Maxno));
|
|
|
|
|
|
sql.Add(') ');
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('BPIOID').Value := Trim(Maxno);
|
|
|
|
|
|
Post;
|
|
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
CDS_Sub.EnableControls;
|
|
|
|
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|
|
|
|
|
|
|
|
|
|
|
Result := True;
|
|
|
|
|
|
except
|
|
|
|
|
|
Result := False;
|
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBSPrtInEdit.TBCloseClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBSPrtInEdit.FormDestroy(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
frmBSPrtInEdit := nil;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBSPrtInEdit.FormShow(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
fsj: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
ReadCxGrid(FSTKName + '<27><><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>', Tv1, '<27><><EFBFBD>ϲֿ<CFB2>');
|
|
|
|
|
|
|
|
|
|
|
|
self.Caption := FSTKName + '<27><><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>';
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add(' select A.* ');
|
|
|
|
|
|
sql.Add(' from BS_Product_IO A');
|
|
|
|
|
|
sql.Add(' where BPIOID=''' + Trim(FBCId) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
SCreateCDS(ADOQueryTemp, CDS_Sub);
|
|
|
|
|
|
SInitCDSData(ADOQueryTemp, CDS_Sub);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBSPrtInEdit.TBDelClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_Sub.IsEmpty then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
if Trim(CDS_Sub.fieldbyname('BPIOID').AsString) <> '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('exec P_Fin_Flow_Judge ');
|
|
|
|
|
|
Sql.Add(' @FFIDS=' + quotedstr(Trim(CDS_Sub.fieldbyname('BPIOID').AsString)));
|
|
|
|
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|
|
|
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if ADOQueryTemp.FieldByName('intReturn').AsInteger = -1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox(PChar(ADOQueryTemp.fieldbyname('ShowMsg').AsString), '<27><>ʾ', 0);
|
|
|
|
|
|
exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
|
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
Sql.Clear;
|
|
|
|
|
|
sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
|
|
|
|
|
|
sql.Add('values(' + quotedstr(FSTKName + '<27><><EFBFBD><EFBFBD>'));
|
|
|
|
|
|
sql.Add(',' + quotedstr(Trim(CDS_Sub.fieldbyname('BPIOID').AsString)));
|
|
|
|
|
|
sql.Add(',''ɾ<><C9BE>'' ');
|
|
|
|
|
|
sql.Add(',' + quotedstr(DName));
|
|
|
|
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|
|
|
|
|
sql.Add(',' + quotedstr(Trim(CDS_Sub.fieldbyname('BPIOID').AsString)));
|
|
|
|
|
|
sql.Add(') ');
|
|
|
|
|
|
|
|
|
|
|
|
Sql.Add('exec P_BS_Product_In_Del ');
|
|
|
|
|
|
Sql.Add(' @BPIOIDS=' + quotedstr(Trim(CDS_Sub.fieldbyname('BPIOID').AsString)));
|
|
|
|
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|
|
|
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|
|
|
|
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|
|
|
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|
|
|
|
|
CDS_Sub.Delete;
|
|
|
|
|
|
except
|
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
CDS_Sub.Delete;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBSPrtInEdit.TBSaveClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_Sub.IsEmpty then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
if CDS_Sub.Locate('IOTime', null, []) = True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD>䲻<EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if CDS_Sub.Locate('IOType', null, []) = True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if CDS_Sub.Locate('P_Name', null, []) = True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if CDS_Sub.Locate('Qty', null, []) = True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if CDS_Sub.Locate('QtyUnit', null, []) = True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if SaveCKData() then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|
|
|
|
|
ModalResult := 1;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBSPrtInEdit.ToolButton1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
WriteCxGrid(FSTKName + '<27><><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>', Tv1, '<27><><EFBFBD>ϲֿ<CFB2>');
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBSPrtInEdit.ToolButton2Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmJWLPurchasePlanSel := TfrmJWLPurchasePlanSel.Create(Application);
|
|
|
|
|
|
with frmJWLPurchasePlanSel do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with CDS_1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not Eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_1.fieldbyname('SSel').AsBoolean then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Append;
|
|
|
|
|
|
FieldByName('IOType').Value := '<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('FromCoNo').Value := CDS_1.fieldbyname('SellNo').value;
|
|
|
|
|
|
FieldByName('FromCoName').Value := CDS_1.fieldbyname('SellName').value;
|
|
|
|
|
|
|
|
|
|
|
|
FieldByName('StkCoNo').Value := Trim(CDS_1.fieldbyname('BuyNo').AsString);
|
|
|
|
|
|
FieldByName('StkCoName').Value := CDS_1.fieldbyname('BuyName').value;
|
|
|
|
|
|
|
|
|
|
|
|
FieldByName('Brand').Value := CDS_1.fieldbyname('Brand').value;
|
|
|
|
|
|
FieldByName('P_Code').Value := CDS_1.fieldbyname('Y_Code').value;
|
|
|
|
|
|
FieldByName('P_Name').Value := CDS_1.fieldbyname('Y_Name').value;
|
|
|
|
|
|
FieldByName('P_Spec').Value := CDS_1.fieldbyname('Y_Spec').value;
|
|
|
|
|
|
FieldByName('P_Color').Value := CDS_1.fieldbyname('Y_Color').value;
|
|
|
|
|
|
|
|
|
|
|
|
FieldByName('Qty').Value := CDS_1.fieldbyname('Qty').value;
|
|
|
|
|
|
FieldByName('Price').Value := CDS_1.fieldbyname('Price').value;
|
|
|
|
|
|
FieldByName('Amount').Value := CDS_1.fieldbyname('Amount').value;
|
|
|
|
|
|
FieldByName('QtyUnit').Value := CDS_1.fieldbyname('QtyUnit').value;
|
|
|
|
|
|
FieldByName('IOTime').Value := Trim(FormatDateTime('yyyy-MM-dd', Now));
|
|
|
|
|
|
|
|
|
|
|
|
FieldByName('FromPurNo').Value := CDS_1.fieldbyname('PurNo').value;
|
|
|
|
|
|
FieldByName('FromPurMId').Value := CDS_1.fieldbyname('PurMId').value;
|
|
|
|
|
|
FieldByName('FromPurSId').Value := CDS_1.fieldbyname('PurSId').value;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmJWLPurchasePlanSel.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-07-15 15:06:22 +08:00
|
|
|
|
procedure TfrmBSPrtInEdit.ToolButton3Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// i := CDS_Sub.RecordCount + 1;
|
|
|
|
|
|
try
|
|
|
|
|
|
frmPurchasePlanSel := TfrmPurchasePlanSel.Create(Application);
|
|
|
|
|
|
with frmPurchasePlanSel do
|
|
|
|
|
|
begin
|
|
|
|
|
|
FSTKName := Self.FSTKName;
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with CDS_1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not Eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_1.FieldByName('SSel').AsBoolean then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
append;
|
|
|
|
|
|
FieldByName('IOTime').Value := Trim(FormatDateTime('yyyy-MM-dd', now));
|
|
|
|
|
|
FieldByName('StkCoNo').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|
|
|
|
|
FieldByName('StkCoName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
2025-09-13 14:39:43 +08:00
|
|
|
|
FieldByName('FromCoName').Value := frmPurchasePlanSel.CDS_1.fieldbyname('SellName').value;
|
2025-07-15 15:06:22 +08:00
|
|
|
|
FieldByName('IOType').Value := '<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('P_Code').Value := frmPurchasePlanSel.CDS_1.fieldbyname('Y_Code').value;
|
|
|
|
|
|
FieldByName('P_Name').Value := frmPurchasePlanSel.CDS_1.fieldbyname('Y_Name').value;
|
|
|
|
|
|
FieldByName('P_Spec').Value := frmPurchasePlanSel.CDS_1.fieldbyname('Y_Spec').value;
|
|
|
|
|
|
FieldByName('Style').Value := frmPurchasePlanSel.CDS_1.fieldbyname('C_Degree').value;
|
|
|
|
|
|
FieldByName('Brand').Value := frmPurchasePlanSel.CDS_1.fieldbyname('Brand').value;
|
|
|
|
|
|
FieldByName('QtyUnit').Value := frmPurchasePlanSel.CDS_1.fieldbyname('QtyUnit').value;
|
|
|
|
|
|
FieldByName('Price').Value := frmPurchasePlanSel.CDS_1.fieldbyname('Price').value;
|
|
|
|
|
|
|
2025-09-13 14:39:43 +08:00
|
|
|
|
FieldByName('FromPurSId').Value := frmPurchasePlanSel.CDS_1.fieldbyname('PurSId').value;
|
|
|
|
|
|
FieldByName('FromPurMId').Value := frmPurchasePlanSel.CDS_1.fieldbyname('PurMId').value;
|
2025-07-15 15:06:22 +08:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmPurchasePlanSel.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-07-10 17:28:43 +08:00
|
|
|
|
procedure TfrmBSPrtInEdit.TbAdd2Click(Sender: TObject);
|
2025-07-11 09:41:07 +08:00
|
|
|
|
//var
|
|
|
|
|
|
// i: Integer;
|
2025-07-10 17:28:43 +08:00
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2025-07-11 09:41:07 +08:00
|
|
|
|
// i := CDS_Sub.RecordCount + 1;
|
2025-07-10 17:28:43 +08:00
|
|
|
|
try
|
|
|
|
|
|
frmGKManageSel := TfrmGKManageSel.Create(Application);
|
|
|
|
|
|
with frmGKManageSel do
|
|
|
|
|
|
begin
|
|
|
|
|
|
FSTKName := Self.FSTKName;
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
2025-07-11 09:41:07 +08:00
|
|
|
|
with CDS_HZ do
|
2025-07-10 17:28:43 +08:00
|
|
|
|
begin
|
2025-07-11 09:41:07 +08:00
|
|
|
|
First;
|
|
|
|
|
|
while not Eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_HZ.FieldByName('SSel').AsBoolean then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
append;
|
|
|
|
|
|
FieldByName('IOTime').Value := Trim(FormatDateTime('yyyy-MM-dd', Now));
|
|
|
|
|
|
FieldByName('StkCoNo').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|
|
|
|
|
FieldByName('StkCoName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|
|
|
|
|
FieldByName('IOType').Value := '<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('P_Code').Value := frmGKManageSel.CDS_HZ.fieldbyname('GKBH').value;
|
|
|
|
|
|
FieldByName('P_Name').Value := frmGKManageSel.CDS_HZ.fieldbyname('GKKH').value;
|
|
|
|
|
|
FieldByName('P_Spec').Value := frmGKManageSel.CDS_HZ.fieldbyname('GKLength').value;
|
|
|
|
|
|
// FieldByName('Qty').Value := frmGKManageSel.CDS_HZ.fieldbyname('kcqty').value;
|
|
|
|
|
|
FieldByName('Style').Value := '<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
next;
|
|
|
|
|
|
end;
|
2025-07-10 17:28:43 +08:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmGKManageSel.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-03-01 10:55:52 +08:00
|
|
|
|
procedure TfrmBSPrtInEdit.Tv1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|
|
|
|
|
with frmCompanySel do
|
|
|
|
|
|
begin
|
|
|
|
|
|
FCoType := '<27>ͻ<EFBFBD>';
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('StkCoNo').Value := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|
|
|
|
|
FieldByName('StkCoName').Value := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmCompanySel.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBSPrtInEdit.Tv1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
2025-07-10 17:28:43 +08:00
|
|
|
|
if CDS_Sub.FieldByName('style').Value = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
2025-03-01 10:55:52 +08:00
|
|
|
|
begin
|
2025-07-10 17:28:43 +08:00
|
|
|
|
frmProductInfoSel := TfrmProductInfoSel.Create(Application);
|
|
|
|
|
|
with frmProductInfoSel do
|
2025-03-01 10:55:52 +08:00
|
|
|
|
begin
|
2025-07-10 17:28:43 +08:00
|
|
|
|
FSTKName := Self.FSTKName;
|
|
|
|
|
|
if ShowModal = 1 then
|
2025-03-01 10:55:52 +08:00
|
|
|
|
begin
|
2025-07-10 17:28:43 +08:00
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('P_Code').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Code').value;
|
|
|
|
|
|
FieldByName('P_Name').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Name').value;
|
|
|
|
|
|
FieldByName('P_Spec').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Spec').value;
|
|
|
|
|
|
FieldByName('QtyUnit').Value := frmProductInfoSel.CDS_1.fieldbyname('QtyUnit').value;
|
|
|
|
|
|
FieldByName('Price').Value := frmProductInfoSel.CDS_1.fieldbyname('Price').value;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else if CDS_Sub.FieldByName('style').Value = '<27><><EFBFBD><EFBFBD>' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
frmGKManageSel := TfrmGKManageSel.Create(Application);
|
|
|
|
|
|
with frmGKManageSel do
|
|
|
|
|
|
begin
|
|
|
|
|
|
FSTKName := Self.FSTKName;
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('P_Code').Value := frmGKManageSel.CDS_HZ.fieldbyname('GKBH').value;
|
|
|
|
|
|
FieldByName('P_Name').Value := frmGKManageSel.CDS_HZ.fieldbyname('GKKH').value;
|
|
|
|
|
|
FieldByName('P_Spec').Value := frmGKManageSel.CDS_HZ.fieldbyname('GKLength').value;
|
|
|
|
|
|
end;
|
2025-03-01 10:55:52 +08:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
2025-07-10 17:28:43 +08:00
|
|
|
|
|
2025-03-01 10:55:52 +08:00
|
|
|
|
finally
|
2025-07-10 17:28:43 +08:00
|
|
|
|
frmGKManageSel.Free;
|
2025-03-01 10:55:52 +08:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBSPrtInEdit.v1Column14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|
|
|
|
|
with frmCompanySel do
|
|
|
|
|
|
begin
|
|
|
|
|
|
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('FromCoNo').Value := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|
|
|
|
|
FieldByName('FromCoName').Value := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmCompanySel.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBSPrtInEdit.v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|
|
|
|
|
with frmZDYHelp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
flag := 'StkPosition';
|
|
|
|
|
|
flagname := '<27><>λ';
|
|
|
|
|
|
MainType := FSTKName;
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('StkPosition').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmZDYHelp.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-08-24 15:16:44 +08:00
|
|
|
|
procedure TfrmBSPrtInEdit.v1QtyUnitPropertiesButtonClick(Sender: TObject;
|
|
|
|
|
|
AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|
|
|
|
|
with frmZDYHelp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
flag := 'QtyUnit';
|
|
|
|
|
|
flagname := '<27><>λ';
|
|
|
|
|
|
MainType := FSTKName;
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('QtyUnit').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmZDYHelp.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-03-01 10:55:52 +08:00
|
|
|
|
end.
|
|
|
|
|
|
|