1286 lines
38 KiB
ObjectPascal
1286 lines
38 KiB
ObjectPascal
unit U_ClothSCDCGAnPai;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
||
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
|
||
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
||
cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter, RM_Common, RM_Class,
|
||
RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxTextEdit, cxCheckBox,
|
||
BtnEdit, RM_BarCode, cxPC, Menus, dxCore, ActiveX, cxLookAndFeels,
|
||
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, dxSkinsCore, dxSkinBlack,
|
||
dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
|
||
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||
dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
||
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
|
||
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinsDefaultPainters,
|
||
dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue,
|
||
dxSkinscxPCPainter;
|
||
|
||
type
|
||
TfrmClothSCDCGAnPai = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
Label3: TLabel;
|
||
ConNo: TEdit;
|
||
CDS_PRT: TClientDataSet;
|
||
RM2: TRMGridReport;
|
||
RMDBPRT: TRMDBDataSet;
|
||
ADOQueryPrint: TADOQuery;
|
||
DSAnPai: TDataSource;
|
||
CDS_AnPai: TClientDataSet;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
ZhuanQty: TEdit;
|
||
Label9: TLabel;
|
||
Panel2: TPanel;
|
||
cxGrid3: TcxGrid;
|
||
Tv3: TcxGridDBTableView;
|
||
cxGridLevel2: TcxGridLevel;
|
||
v3Column1: TcxGridDBColumn;
|
||
v3Column2: TcxGridDBColumn;
|
||
Label2: TLabel;
|
||
C_CodeName: TEdit;
|
||
Label6: TLabel;
|
||
PS: TEdit;
|
||
Label7: TLabel;
|
||
JXPerson: TBtnEditA;
|
||
Button2: TButton;
|
||
Button1: TButton;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
v2Column2: TcxGridDBColumn;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
v2Column4: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
DataSource3: TDataSource;
|
||
Order_Main: TClientDataSet;
|
||
v3Column3: TcxGridDBColumn;
|
||
v3Column4: TcxGridDBColumn;
|
||
v3Column5: TcxGridDBColumn;
|
||
Label4: TLabel;
|
||
C_Code: TEdit;
|
||
v3Column6: TcxGridDBColumn;
|
||
Label5: TLabel;
|
||
Label8: TLabel;
|
||
APPS: TEdit;
|
||
PSSX: TEdit;
|
||
Label10: TLabel;
|
||
v2Column3: TcxGridDBColumn;
|
||
v3Column7: TcxGridDBColumn;
|
||
Button3: TButton;
|
||
v3Column8: TcxGridDBColumn;
|
||
v3Column9: TcxGridDBColumn;
|
||
Label11: TLabel;
|
||
ChouZhen: TEdit;
|
||
v3Column10: TcxGridDBColumn;
|
||
v3Column11: TcxGridDBColumn;
|
||
v3Column13: TcxGridDBColumn;
|
||
v3Column14: TcxGridDBColumn;
|
||
v3Column15: TcxGridDBColumn;
|
||
v3Column16: TcxGridDBColumn;
|
||
v3Column17: TcxGridDBColumn;
|
||
Label13: TLabel;
|
||
v3Column18: TcxGridDBColumn;
|
||
Label14: TLabel;
|
||
v2Column5: TcxGridDBColumn;
|
||
v3Column20: TcxGridDBColumn;
|
||
v3Column21: TcxGridDBColumn;
|
||
ToolButton1: TToolButton;
|
||
tbKS: TToolButton;
|
||
cxTabControl1: TcxTabControl;
|
||
tbKSCX: TToolButton;
|
||
tbJS: TToolButton;
|
||
tbJSCX: TToolButton;
|
||
ToolButton6: TToolButton;
|
||
ToolButton7: TToolButton;
|
||
ToolButton8: TToolButton;
|
||
ToolButton9: TToolButton;
|
||
ToolButton10: TToolButton;
|
||
ToolButton11: TToolButton;
|
||
Label15: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
ToolButton12: TToolButton;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
ToolButton2: TToolButton;
|
||
RMDBPZ: TRMDBDataSet;
|
||
CDS_PZ: TClientDataSet;
|
||
CDS_SJ: TClientDataSet;
|
||
RMDBSJ: TRMDBDataSet;
|
||
RM1: TRMGridReport;
|
||
RMDB_BP: TRMDBDataSet;
|
||
Label37: TLabel;
|
||
Edit13: TEdit;
|
||
v2Column6: TcxGridDBColumn;
|
||
v3Column12: TcxGridDBColumn;
|
||
Panel3: TPanel;
|
||
APBatchNo: TBtnEditA;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ConNoChange(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure JXPersonBtnClick(Sender: TObject);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure Button3Click(Sender: TObject);
|
||
procedure PSKeyPress(Sender: TObject; var Key: Char);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure tbKSClick(Sender: TObject);
|
||
procedure tbKSCXClick(Sender: TObject);
|
||
procedure tbJSClick(Sender: TObject);
|
||
procedure tbJSCXClick(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure ToolButton7Click(Sender: TObject);
|
||
procedure ToolButton8Click(Sender: TObject);
|
||
procedure ToolButton9Click(Sender: TObject);
|
||
procedure ToolButton10Click(Sender: TObject);
|
||
procedure ToolButton11Click(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure ToolButton12Click(Sender: TObject);
|
||
procedure Tv3CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure Edit13Click(Sender: TObject);
|
||
procedure APBatchNoBtnClick(Sender: TObject);
|
||
procedure v3Column8PropertiesEditValueChanged(Sender: TObject);
|
||
private
|
||
FInt, PFInt: Integer;
|
||
FFMainID: string;
|
||
procedure InitGrid();
|
||
procedure InitGridBP();
|
||
procedure SetStatus();
|
||
function SaveDataAP(): Boolean;
|
||
procedure PrintPB(MAPID: string);
|
||
procedure UpdateJTInfo(RTMainId: string);
|
||
{ Private declarations }
|
||
public
|
||
canshu1: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_ZDYHelp, U_JTSel, U_ClothSCInPut, U_RTFun;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmClothSCDCGAnPai.SetStatus();
|
||
begin
|
||
tbKS.Visible := False;
|
||
tbKSCX.Visible := False;
|
||
tbJS.Visible := False;
|
||
tbJSCX.Visible := False;
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
tbKS.Visible := True;
|
||
end;
|
||
|
||
1:
|
||
begin
|
||
tbKSCX.Visible := True;
|
||
tbJS.Visible := True;
|
||
end;
|
||
2:
|
||
begin
|
||
tbJSCX.Visible := True;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.InitGridBP();
|
||
begin
|
||
Label10.Caption := Trim(Order_Main.fieldbyname('ConNo').AsString);
|
||
APPS.Text := Trim(Order_Main.fieldbyname('APPS').AsString);
|
||
PSSX.Text := Trim(Order_Main.fieldbyname('ZSCPS').AsString);
|
||
APBatchNo.Text := Trim(Order_Main.fieldbyname('BatchNoHZ').AsString);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add(' select Top 100*');
|
||
sql.Add(' from JYCon_Sub_AnPai A');
|
||
sql.Add(' where A.SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
sql.Add(' and A.MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' order by FillTime desc');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_AnPai);
|
||
SInitCDSData20(ADOQueryTemp, CDS_AnPai);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add(' select COUNT(JYFlag) wjps');
|
||
sql.Add(' from JYCon_Sub_AnPai A');
|
||
sql.Add(' where A.JYFlag=0 and A.SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
sql.Add(' and A.MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
Label13.caption := 'δ<><CEB4><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>' + trim(inttostr(ADOQueryTemp.fieldbyname('wjps').asinteger));
|
||
|
||
v2Column3.SortOrder := soDescending;
|
||
|
||
CDS_AnPai.Last;
|
||
if CDS_AnPai.IsEmpty then
|
||
APBatchNo.Text := Trim(Order_Main.fieldbyname('BatchNoHZ').AsString)
|
||
else
|
||
APBatchNo.Text := Trim(CDS_AnPai.fieldbyname('APBatchNo').AsString);
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.PrintPB(MAPID: string);
|
||
var
|
||
fPrintFile: string;
|
||
i: Integer;
|
||
FDate: string;
|
||
Txt, fImagePath: string;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
GYLabName: string;
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.*, ');
|
||
sql.Add(' AA.APID,A.ZhuanQty,AA.SCPerson,AA.CarNo,AA.CheJian ,AA.XHInt,AA.JXPerson,AA.APBatchNo,AA.PRTFlag,AA.PRTCount');
|
||
sql.Add(' from JYCon_Sub_AnPai AA');
|
||
sql.Add(' inner join Cloth_Sub A on AA.SubId=A.SubId and AA.Mainid=A.MainId');
|
||
sql.Add(' inner join Cloth_Main B on AA.MainId=B.MainId ');
|
||
sql.Add(' where AA.APId=' + quotedstr(Trim(MAPID)));
|
||
// showmessage(SQL.Text);
|
||
Open;
|
||
end;
|
||
if ADOQueryPrint.IsEmpty then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
GYLabName := Trim(ADOQueryPrint.fieldbyname('LabName').AsString);
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(ADOQueryPrint.fieldbyname('APId').AsString);
|
||
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
||
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
||
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
||
if FileExists(fImagePath) then
|
||
DeleteFile(fImagePath);
|
||
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
||
except
|
||
application.MessageBox('<27><>Ʊ<EFBFBD><C6B1>ӡ<EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
|
||
if Trim(GYLabName) <> '<27><>̧ͷ<CCA7><CDB7>ǩ' then
|
||
begin
|
||
ExportFtErpFile('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩAP.rmf', ADOQueryTemp);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩAP.rmf';
|
||
end
|
||
else
|
||
begin
|
||
ExportFtErpFile('<27><>̧ͷ<CCA7><CDB7>ǩ.rmf', ADOQueryTemp);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><>̧ͷ<CCA7><CDB7>ǩ.rmf';
|
||
end;
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM2.LoadFromFile(fPrintFile);
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RM2.PrintReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.UpdateJTInfo(RTMainId: string);
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update Cloth_Sub Set RTAPJTQty=(select Count(*) from Cloth_JiTai A where A.MainId=Cloth_Sub.MainId )');
|
||
sql.Add(',RTAPJTInfo=dbo.F_Get_Order_SubStr_PB(Cloth_Sub.MainId,''RTAPJTInfo'')');
|
||
sql.Add(',RTQYJTQty=(select Count(*) from Cloth_JiTai A where A.MainId=Cloth_Sub.MainId and StopFlag=0 )');
|
||
sql.Add(',RTQYJTInfo=dbo.F_Get_Order_SubStr_PB(Cloth_Sub.MainId,''RTQYJTInfo'')');
|
||
sql.Add(',RTTYJTQty=(select Count(*) from Cloth_JiTai A where A.MainId=Cloth_Sub.MainId and StopFlag=1 )');
|
||
sql.Add(',RTTYJTInfo=dbo.F_Get_Order_SubStr_PB(Cloth_Sub.MainId,''RTTYJTInfo'')');
|
||
sql.Add(' where MainId=''' + Trim(RTMainId) + '''');
|
||
//Parameters.ParamByName('MainId').Value:=Trim(RTMainId);
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.TBCloseClick(Sender: TObject);
|
||
begin
|
||
if Trim(DName) = 'ADMIN' then
|
||
begin
|
||
WriteCxGridAll(trim(self.Caption), Tv2, ADOQueryCmd, ADOQueryTemp);
|
||
WriteCxGridAll(trim(self.Caption) + '2', Tv3, ADOQueryCmd, ADOQueryTemp);
|
||
end;
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.InitGrid();
|
||
begin
|
||
Panel3.Visible := True;
|
||
Panel3.Refresh;
|
||
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add(' with AP As (SELECT TOP 1 JXPerson,mainid FROM JYCon_Sub_AnPai AP WHERE ISNULL(AP.JXPerson,'''') <> '''' ORDER BY AP.FillTime DESC) ');
|
||
sql.Add('select B.*,C.* ');
|
||
sql.Add(',APPS=(select count(MainId) from JYCon_Sub_AnPai JSA where JSA.MainId=B.MainId )');
|
||
sql.Add(',JYPS=isnull((select Count(MainId) from WFB_MJJY_PB CR where CR.MainId=B.MainId ),0) ');
|
||
// sql.Add(',JXPerson10=(select Top 1 JXPerson from JYCon_Sub_AnPai AP where AP.MainId=B.MainId and isnull(AP.JXPerson,'''')<>'''' Order by AP.FillTime Desc)');
|
||
sql.Add(' from Cloth_Main B ');
|
||
sql.Add(' inner join Cloth_Sub C on B.MainId=C.MainId');
|
||
sql.Add('left join Ap on AP.mainid=B.mainid ');
|
||
sql.Add(' where (isnull(B.status,''0'') in(''1'',''2'') or ConType=''ƥ<><C6A5>'' )');
|
||
if cxTabControl1.TabIndex > 1 then
|
||
begin
|
||
sql.Add(' and B.QDTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + '''');
|
||
sql.Add(' and B.QDTime<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)) + '''');
|
||
end;
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
sql.Add(' and BegFlag=0 and EndFlag=0 ');
|
||
end;
|
||
|
||
1:
|
||
begin
|
||
sql.Add(' and BegFlag=1 and EndFlag=0 ');
|
||
end;
|
||
2:
|
||
begin
|
||
sql.Add(' and EndFlag=1 ');
|
||
end;
|
||
end;
|
||
// ShowMessage(SQL.text);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
Panel3.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
|
||
InitGrid();
|
||
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.ConNoChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, Order_Main);
|
||
SInitCDSData20(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGridAll(trim(self.Caption), Tv2);
|
||
ReadCxGridAll(trim(self.Caption) + '2', Tv3);
|
||
SetStatus();
|
||
// InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.JXPersonBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'JXPerson';
|
||
flagname := '<27><><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
JXPerson.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.Button2Click(Sender: TObject);
|
||
var
|
||
FFDS: Integer;
|
||
FGYCarNo: string;
|
||
begin
|
||
if cxTabControl1.TabIndex <> 1 then
|
||
Exit;
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if Order_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(PS.Text) = '' then
|
||
begin
|
||
Application.MessageBox('ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if TryStrToInt(Trim(PS.Text), FFDS) = False then
|
||
begin
|
||
Application.MessageBox('ƥ<><C6A5><EFBFBD>Ƿ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
// if Trim(JXPerson.Text) = '' then
|
||
// begin
|
||
// Application.MessageBox('<27><><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><DEB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
// Exit;
|
||
// end;
|
||
if Edit13.Text = '<27><>' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD>ⷢ<EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD>Ʊ<EFBFBD><C6B1>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
end;
|
||
|
||
if SaveDataAP() then
|
||
begin
|
||
InitGrid();
|
||
InitGridBP();
|
||
end;
|
||
CDS_AnPai.Last;
|
||
end;
|
||
|
||
function TfrmClothSCDCGAnPai.SaveDataAP(): Boolean;
|
||
var
|
||
maxno, fPrintFile: string;
|
||
i, j, GYSYPS: Integer;
|
||
FDate: string;
|
||
Txt, fImagePath: string;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
GYMainId, GYSubId, GYCarNo, GYC_Code, GYC_CodeName, GYConNo, GYXHInt, GYLabName: string;
|
||
GYCheJian, GYBatchNOHZ, GYChouZhen, GYCarType, GYC_Spec, GYC_CPName, GYC_ZhenCun, GYC_Custom, GYC_gongyi: string;
|
||
begin
|
||
cxGrid3.Enabled := False;
|
||
FDate := FormatDateTime('yyyy-MM-dd', SGetServerDate(ADOQueryTemp));
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Locate('SSel', True, []) do
|
||
begin
|
||
GYMainId := Trim(Order_Main.fieldbyname('Mainid').AsString);
|
||
GYSubId := Trim(Order_Main.fieldbyname('SubId').AsString);
|
||
GYC_Code := Trim(Order_Main.fieldbyname('C_Code').AsString);
|
||
GYC_CodeName := Trim(Order_Main.fieldbyname('C_CodeName').AsString);
|
||
GYConNo := Trim(Order_Main.fieldbyname('ConNo').AsString);
|
||
GYLabName := Trim(Order_Main.fieldbyname('LabName').AsString);
|
||
GYBatchNOHZ := Trim(Order_Main.fieldbyname('BatchNOHZ').AsString);
|
||
GYChouZhen := Trim(Order_Main.fieldbyname('ChouZhen').AsString);
|
||
GYCarType := Trim(Order_Main.fieldbyname('CarType').AsString);
|
||
GYC_Spec := Trim(Order_Main.fieldbyname('C_Spec').AsString);
|
||
GYC_gongyi := Trim(Order_Main.fieldbyname('gongyi').AsString);
|
||
GYC_ZhenCun := Trim(Order_Main.fieldbyname('ZhenCun').AsString);
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select ');
|
||
sql.Add(' SYPS=C.ZSCPS-(select count(MainId) from JYCon_Sub_AnPai JSA where JSA.MainId=B.MainId )');
|
||
sql.Add(' from Cloth_Main B ');
|
||
sql.Add(' inner join Cloth_Sub C on B.MainId=C.MainId');
|
||
sql.Add(' where B.EndFlag=0 and isnull(B.status,''0'')=''2''');
|
||
SQL.Add(' and B.MainId=' + quotedstr(GYMainId));
|
||
Open;
|
||
end;
|
||
GYSYPS := ADOQueryTemp.fieldbyname('SYPS').AsInteger;
|
||
|
||
// if GYSYPS > StrToInt(PS.Text) then
|
||
// j := StrToInt(PS.Text)
|
||
// else
|
||
// j := GYSYPS;
|
||
j := StrToInt(PS.Text);
|
||
for i := 1 to j do
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
if GetLSNo(ADOQueryCmd, maxno, 'YF', 'JYCon_Sub_AnPai', 4, 1) = False then
|
||
begin
|
||
cxGrid3.Enabled := True;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from JYCon_Sub_AnPai where 1=2');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('MainId').Value := Trim(GYMainId);
|
||
FieldByName('SubId').Value := Trim(GYSubId);
|
||
FieldByName('APId').Value := Trim(maxno);
|
||
FieldByName('JXPerson').Value := Trim(JXPerson.Text);
|
||
FieldByName('APBatchNo').Value := Trim(APBatchNo.Text);
|
||
FieldByName('CarNo').Value := Trim(GYCarNo);
|
||
FieldByName('CheJian').Value := Trim(GYCheJian);
|
||
FieldByName('PRTCount').Value := 1;
|
||
if Trim(Edit13.Text) <> '' then
|
||
FieldByName('BuPiaoType').Value := '<27>ⷢ<EFBFBD>ӹ<EFBFBD>';
|
||
FieldByName('APDate').Value := FDate;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
Post;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' Update JYCon_Sub_AnPai Set XHInt=isnull((select Max(XHInt) from JYCon_Sub_AnPai A where A.MainId=JYCon_Sub_AnPai.MainId and A.CarNo=JYCon_Sub_AnPai.CarNo ),0)+1');
|
||
sql.Add(' ,QDTime=(select DoTime from Cloth_JiTai JT where JT.MainId=''' + Trim(GYMainId) + ''' and CarNo=''' + Trim(GYCarNo) + '''');
|
||
sql.Add(' and StopFlag=0 )');
|
||
sql.Add(' where APId=''' + Trim(maxno) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
PrintPB(maxno);
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><>ӡ<EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
Sleep(500);
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
|
||
FFMainID := '';
|
||
cxGrid3.Enabled := True;
|
||
Result := True;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.Button1Click(Sender: TObject);
|
||
begin
|
||
if cxTabControl1.TabIndex <> 1 then
|
||
Exit;
|
||
if CDS_AnPai.IsEmpty then
|
||
Exit;
|
||
if CDS_AnPai.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if CDS_AnPai.Locate('SSel;JYFlag', VarArrayOf([True, True]), []) then
|
||
begin
|
||
Application.MessageBox('<27>Ѽ<EFBFBD><D1BC>鲻<EFBFBD><E9B2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
CDS_AnPai.DisableControls;
|
||
with CDS_AnPai do
|
||
begin
|
||
while CDS_AnPai.FieldByName('SSel').AsBoolean = True do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete JYCon_Sub_AnPai ');
|
||
sql.Add(' where APId=''' + Trim(CDS_AnPai.fieldbyname('APID').AsString) + '''');
|
||
sql.Add(' and not exists(select * from WFB_MJJY_PB A where A.MJID=JYCon_Sub_AnPai.APID)');
|
||
ExecSQL;
|
||
end;
|
||
CDS_AnPai.Delete;
|
||
end;
|
||
end;
|
||
CDS_AnPai.EnableControls;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
CDS_AnPai.EnableControls;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.Button3Click(Sender: TObject);
|
||
begin
|
||
if cxTabControl1.TabIndex <> 1 then
|
||
Exit;
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if CDS_AnPai.IsEmpty then
|
||
Exit;
|
||
if CDS_AnPai.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if CDS_AnPai.Locate('SSel;JYFlag', VarArrayOf([True, True]), []) then
|
||
begin
|
||
Application.MessageBox('<27>Ѽ<EFBFBD><D1BC>鲻<EFBFBD><E9B2BB><EFBFBD>ش<EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
with CDS_AnPai do
|
||
begin
|
||
while CDS_AnPai.Locate('SSel', true, []) do
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_Main where Mainid=''' + Trim(CDS_AnPai.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
|
||
CDS_AnPai.Edit;
|
||
CDS_AnPai.FieldByName('PRTFlag').Value := 1;
|
||
CDS_AnPai.FieldByName('PRTCount').Value := 2;
|
||
CDS_AnPai.Post;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate JYCon_Sub_AnPai Set PRTFlag=1,PRTCount=2 ');
|
||
sql.Add(' where APId=''' + Trim(CDS_AnPai.fieldbyname('APID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
PrintPB(CDS_AnPai.fieldbyname('APID').AsString);
|
||
CDS_AnPai.Edit;
|
||
CDS_AnPai.FieldByName('SSel').Value := false;
|
||
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.PSKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
Button2.Click;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'WFBCPBZZ';
|
||
flagname := '<27>õ<EFBFBD>';
|
||
fnote := True;
|
||
// V1Note.Caption:='Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.tbKSClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
Exit;
|
||
if Order_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>п<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Locate('SSel', True, []) = True do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate Cloth_Main Set Begtime=getdate(),BegPerson=''' + Trim(DName) + ''',BegFlag=1');
|
||
sql.Add(' where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.tbKSCXClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if cxTabControl1.TabIndex <> 1 then
|
||
Exit;
|
||
if Order_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>п<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Locate('SSel', True, []) = True do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate Cloth_Main Set Begtime=getdate(),BegPerson=''' + Trim(DName) + ''',BegFlag=0');
|
||
sql.Add(' where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.tbJSClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if cxTabControl1.TabIndex = 2 then
|
||
Exit;
|
||
if cxTabControl1.TabIndex = 3 then
|
||
Exit;
|
||
if Order_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Locate('SSel', True, []) = True do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate Cloth_Main Set Endtime=getdate(),EndPerson=''' + Trim(DName) + ''',EndFlag=1');
|
||
sql.Add(' where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add('UPdate Cloth_JiTai SET StopFlag=1,DOTime=getdate(),DOPerson=''' + Trim(DName) + '''');
|
||
sql.Add(',TYTime=getdate(),TYPerson=''' + Trim(DName) + '''');
|
||
sql.Add(' where MainId=' + quotedstr(trim(Order_Main.fieldbyname('MainId').AsString)));
|
||
sql.Add(' and StopFlag=0');
|
||
ExecSQL;
|
||
end;
|
||
UpdateJTInfo(Trim(Order_Main.fieldbyname('MainId').AsString));
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.tbJSCXClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if cxTabControl1.TabIndex <> 2 then
|
||
Exit;
|
||
if Order_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while Locate('SSel', True, []) = True do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate Cloth_Main Set Endtime=getdate(),EndPerson=''' + Trim(DName) + ''',EndFlag=0');
|
||
sql.Add(' where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
Order_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.ToolButton6Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'SCPerson';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
fnote := True;
|
||
V1Note.Caption := '<27><><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.ToolButton7Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'JXPerson';
|
||
flagname := '<27><><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.ToolButton8Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'ClothType';
|
||
flagname := '<27><>ƥ<EFBFBD>ȼ<EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.ToolButton9Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmJTSel := TfrmJTSel.Create(Application);
|
||
with frmJTSel do
|
||
begin
|
||
|
||
if ShowModal = 1 then
|
||
begin
|
||
with frmJTSel.ClientDataSet1 do
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmJTSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.ToolButton10Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'houdang';
|
||
flagname := '<27><><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.ToolButton11Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'WorkShift';
|
||
flagname := '<27><><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.FormCreate(Sender: TObject);
|
||
begin
|
||
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
||
BegDate.DateTime := EndDate.DateTime - 60;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.ToolButton12Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmClothSCInPut := TfrmClothSCInPut.Create(Application);
|
||
with frmClothSCInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
FConNo := Trim(Self.Order_Main.fieldbyname('ConNo').AsString);
|
||
TBSave.Visible := False;
|
||
ToolBar3.Visible := False;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothSCInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.Tv3CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
// InitGridBP();
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_AnPai, True);
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_AnPai, False);
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.ToolButton2Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
i, j, k: integer;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
ExportFtErpFile('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>.rmf', ADOQueryTemp);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>.rmf';
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select WeiZhi1=WeiZhi,SPZ1=PZ1,SPZ2=PZ2,SPZ3=PZ3,SPZ4=PZ4,SPZ5=PZ5,SPZ6=PZ6,SPZ7=PZ7,SPZ8=PZ8,SPZ9=PZ9,SPZ10=PZ10, ');
|
||
sql.Add(' SPZ11=PZ11,SPZ12=PZ12,SPZ13=PZ13,SPZ14=PZ14,SPZ15=PZ15,SPZ16=PZ16,SPZ17=PZ17,SPZ18=PZ18,SPZ19=PZ19,SPZ20=PZ20, ');
|
||
sql.Add(' SPZ21=PZ21,SPZ22=PZ22,SPZ23=PZ23,SPZ24=PZ24,SPZ25=PZ25,SPZ26=PZ26,SPZ27=PZ27,SPZ28=PZ28,SPZ29=PZ29,SPZ30=PZ30, ');
|
||
sql.Add(' SPZ31=PZ31,SPZ32=PZ32,SPZ33=PZ33,SPZ34=PZ34,SPZ35=PZ35,SPZ36=PZ36 ');
|
||
sql.Add(' from Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' and RTrim(PZType)=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_PZ);
|
||
SInitCDSData20(ADOQueryTemp, CDS_PZ);
|
||
if CDS_PZ.IsEmpty then
|
||
begin
|
||
CDS_PZ.Append;
|
||
CDS_PZ.Post;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add(' and RTrim(PZType)=''<27><><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_SJ);
|
||
SInitCDSData20(ADOQueryTemp, CDS_SJ);
|
||
|
||
if CDS_SJ.IsEmpty then
|
||
begin
|
||
CDS_SJ.Append;
|
||
CDS_SJ.Post;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Select A.* ');
|
||
sql.Add(',YLQty=Cast(C_Qty*PBQty*0.01*(1+isnull(ZPSH,0)*0.01) as decimal(18,1))');
|
||
sql.Add(' from Cloth_YCL_PB A');
|
||
sql.Add(' inner join Cloth_Sub B on A.SubId=B.SubId');
|
||
sql.Add(' where A.SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_PRT);
|
||
SInitCDSData20(ADOQueryTemp, CDS_PRT);
|
||
if CDS_PRT.IsEmpty then
|
||
begin
|
||
CDS_PRT.Append;
|
||
CDS_PRT.Post;
|
||
end;
|
||
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RMVariables['C_Code'] := Order_Main.fieldbyname('C_Code').Value;
|
||
RMVariables['ConNo'] := Order_Main.fieldbyname('ConNo').Value;
|
||
RMVariables['C_CodeName'] := Order_Main.fieldbyname('C_CodeName').Value;
|
||
RMVariables['DayQty'] := Order_Main.fieldbyname('DayQty').Value;
|
||
RMVariables['CarType'] := Order_Main.fieldbyname('CarType').Value;
|
||
RMVariables['ChouZhen'] := Order_Main.fieldbyname('ChouZhen').Value;
|
||
RMVariables['KZQty'] := Order_Main.fieldbyname('KZQty').Value;
|
||
RMVariables['MFQty'] := Order_Main.fieldbyname('MFQty').Value;
|
||
RMVariables['KZ'] := Order_Main.fieldbyname('KZ').Value;
|
||
RMVariables['MF'] := Order_Main.fieldbyname('MF').Value;
|
||
RMVariables['PiKgQty'] := Order_Main.fieldbyname('PiKgQty').Value;
|
||
RMVariables['ZhuanQty'] := Order_Main.fieldbyname('ZhuanQty').Value;
|
||
RMVariables['PiQty'] := Order_Main.fieldbyname('PiQty').Value;
|
||
RMVariables['C_Qty'] := Order_Main.fieldbyname('C_Qty').Value;
|
||
RMVariables['QDTime'] := Order_Main.fieldbyname('QDTime').Value;
|
||
RMVariables['JHChejian'] := Order_Main.fieldbyname('JHChejian').Value;
|
||
RMVariables['DeliveryDate'] := Order_Main.fieldbyname('DeliveryDate').Value;
|
||
RMVariables['ShaChang1'] := Order_Main.fieldbyname('ShaChang').Value;
|
||
RMVariables['SJCarNO'] := Order_Main.fieldbyname('SJCarNO').Value;
|
||
RMVariables['C_Spec'] := Order_Main.fieldbyname('C_Spec').Value;
|
||
RMVariables['C_Color'] := Order_Main.fieldbyname('C_Color').Value;
|
||
RMVariables['C_Note'] := Order_Main.fieldbyname('C_Note').Value;
|
||
RMVariables['SJCarNO'] := Order_Main.fieldbyname('SJCarNO').Value;
|
||
RMVariables['ChouZhen'] := Order_Main.fieldbyname('ChouZhen').Value;
|
||
RMVariables['PiKgQtyFD'] := Order_Main.fieldbyname('PiKgQtyFD').Value;
|
||
RMVariables['BatchNoHZ'] := Order_Main.fieldbyname('BatchNoHZ').Value;
|
||
RMVariables['Zdr'] := Order_Main.fieldbyname('Filler').Value;
|
||
RMVariables['WzPrice'] := Order_Main.fieldbyname('WzPrice').Value;
|
||
RMVariables['BZNote'] := Order_Main.fieldbyname('BZNote').Value;
|
||
RMVariables['ZZYQ'] := Order_Main.fieldbyname('ZZYQ').Value;
|
||
RMVariables['ZZSH'] := Order_Main.fieldbyname('ZZSH').Value;
|
||
RMVariables['MFZZS'] := Order_Main.fieldbyname('MFZZS').Value;
|
||
RMVariables['ALBL'] := Order_Main.fieldbyname('ALBL').Value;
|
||
RMVariables['gongyi'] := Order_Main.fieldbyname('gongyi').Value;
|
||
RMVariables['ZongJieNote'] := Order_Main.fieldbyname('ZongJieNote').Value;
|
||
RMVariables['ZhenCun'] := Order_Main.fieldbyname('ZhenCun').Value;
|
||
RMVariables['Filler'] := Order_Main.fieldbyname('Filler').Value;
|
||
RMVariables['JHChejian'] := Order_Main.fieldbyname('JHChejian').Value;
|
||
RMVariables['YWY'] := Order_Main.fieldbyname('YWY').Value;
|
||
RMVariables['KJTS'] := Order_Main.fieldbyname('KJTS').Value;
|
||
RMVariables['PBMF'] := Order_Main.fieldbyname('PBMF').Value;
|
||
RMVariables['PBKZ'] := Order_Main.fieldbyname('PBKZ').Value;
|
||
RMVariables['ZongZhenQty'] := Order_Main.fieldbyname('ZongZhenQty').Value;
|
||
RMVariables['PSNote'] := Order_Main.fieldbyname('PSNote').Value;
|
||
RMVariables['SJNote'] := Order_Main.fieldbyname('SJNote').Value;
|
||
RMVariables['ISYT'] := Order_Main.fieldbyname('ISYT').Value;
|
||
RMVariables['ISKF'] := Order_Main.fieldbyname('ISKF').Value;
|
||
RMVariables['ISCZ'] := Order_Main.fieldbyname('ISCZ').Value;
|
||
RMVariables['FactoryNoName'] := Order_Main.fieldbyname('FactoryNoName').Value;
|
||
RMVariables['PBFactoryNoName'] := Order_Main.fieldbyname('PBFactoryNoName').Value;
|
||
RMVariables['JiTaiType'] := Order_Main.fieldbyname('JiTaiType').Value;
|
||
RMVariables['YGPS'] := Order_Main.fieldbyname('YGPS').Value;
|
||
RMVariables['YGQty'] := Order_Main.fieldbyname('YGQty').Value;
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.Edit13Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit13.Text) = '' then
|
||
begin
|
||
Edit13.Text := '<27><>';
|
||
end
|
||
else
|
||
begin
|
||
Edit13.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.APBatchNoBtnClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if Order_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
MainType := Trim(Self.Order_Main.fieldbyname('ConNo').AsString);
|
||
flag := 'APBatchNo';
|
||
flagname := '<27><><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
APBatchNo.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothSCDCGAnPai.v3Column8PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: Boolean;
|
||
fsj: string;
|
||
begin
|
||
mvalue := TcxCheckBox(Sender).EditValue;
|
||
fsj := Trim(Order_Main.fieldbyname('MainId').AsString);
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
Order_Main.DisableControls;
|
||
with Order_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if FieldByName('SSel').AsBoolean = True then
|
||
begin
|
||
Edit;
|
||
FieldByName('SSel').Value := False;
|
||
Post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
Order_Main.Locate('MainId', fsj, []);
|
||
if mvalue = True then
|
||
begin
|
||
with Order_Main do
|
||
begin
|
||
Edit;
|
||
FieldByName('SSel').Value := True;
|
||
Post;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with Order_Main do
|
||
begin
|
||
Edit;
|
||
FieldByName('SSel').Value := False;
|
||
Post;
|
||
end;
|
||
end;
|
||
Order_Main.EnableControls;
|
||
InitGridBP();
|
||
end;
|
||
|
||
end.
|
||
|