D7wmguihua/桂华管理系统/U_ProductionAnPaiNew.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

1007 lines
28 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_ProductionAnPaiNew;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, StdCtrls, ExtCtrls, cxGridLevel,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
cxControls, cxGridCustomView, cxGrid, ADODB, DBClient, cxTextEdit, cxPC,
cxCalendar, ComCtrls, cxButtonEdit, cxGridCustomPopupMenu,
cxGridPopupMenu, Menus, cxCheckBox;
type
TfrmProductionAnPaiNew = class(TForm)
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1OrderNo: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
v1PRTMF: TcxGridDBColumn;
v1PRTKZ: TcxGridDBColumn;
v1Column1: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
Panel1: TPanel;
Label1: TLabel;
Label15: TLabel;
Label16: TLabel;
orderno: TEdit;
v1Column8: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
CDS_Main: TClientDataSet;
DataSource1: TDataSource;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
v1Column14: TcxGridDBColumn;
Button1: TButton;
Button2: TButton;
Button3: TButton;
cxTabControl1: TcxTabControl;
Label2: TLabel;
Label3: TLabel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Button4: TButton;
Button5: TButton;
Panel2: TPanel;
SmalMF1: TEdit;
SmalMF2: TEdit;
SmalMF3: TEdit;
SmalMF4: TEdit;
SmalMF5: TEdit;
SmalMF6: TEdit;
Label4: TLabel;
SmalMF7: TEdit;
SmalMF8: TEdit;
SmalMF9: TEdit;
SmalMF10: TEdit;
SmalMF11: TEdit;
SmalMF12: TEdit;
Button6: TButton;
cxGridPopupMenu1: TcxGridPopupMenu;
Button7: TButton;
v1Column26: TcxGridDBColumn;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
cxGridDBColumn2: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
cxGridDBColumn5: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
cxGridDBColumn8: TcxGridDBColumn;
cxGridDBColumn9: TcxGridDBColumn;
cxGridDBColumn10: TcxGridDBColumn;
cxGridDBColumn11: TcxGridDBColumn;
cxGridDBColumn12: TcxGridDBColumn;
cxGridDBColumn13: TcxGridDBColumn;
cxGridDBColumn22: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
DSSCAnPai: TDataSource;
CDS_SCAnPai: TClientDataSet;
cxGridPopupMenu2: TcxGridPopupMenu;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
v2Column1: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
v2Column4: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
ADOQuerySub: TADOQuery;
v2Column5: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
v2Column7: TcxGridDBColumn;
v2Column8: TcxGridDBColumn;
Label5: TLabel;
SWFBCodeName: TEdit;
Label6: TLabel;
FSWFBFK10: TEdit;
Label7: TLabel;
SWFBKZ10: TEdit;
v2Column9: TcxGridDBColumn;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ordernoChange(Sender: TObject);
procedure v1Column4PropertiesEditValueChanged(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Tv1DblClick(Sender: TObject);
procedure v1Column19PropertiesEditValueChanged(Sender: TObject);
procedure v1Column23PropertiesEditValueChanged(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure v1Column24PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure v1Column24PropertiesEditValueChanged(Sender: TObject);
procedure v1Column25PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure v1Column25PropertiesEditValueChanged(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure N1Click(Sender: TObject);
// procedure cxGridDBColumn1PropertiesEditValueChanged(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure Tv2CellClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure Tv1CellClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure v2Column5PropertiesEditValueChanged(Sender: TObject);
procedure v2Column6PropertiesEditValueChanged(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure v2Column8PropertiesEditValueChanged(Sender: TObject);
private
{ Private declarations }
procedure InitGrid();
procedure VisbleControl(Panel55:TWinControl;XS:Boolean;SXCount:Integer);
procedure InitGridAnPai();
public
{ Public declarations }
end;
var
frmProductionAnPaiNew: TfrmProductionAnPaiNew;
implementation
uses
U_DataLink,U_Fun,U_OrderAttachment,U_ZDYHelpSel,U_JiangLiaoSet;
{$R *.dfm}
procedure TfrmProductionAnPaiNew.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
orderno.SetFocus;
Action:=caFree;
end;
procedure TfrmProductionAnPaiNew.FormDestroy(Sender: TObject);
begin
frmProductionAnPaiNew:=nil;
end;
procedure TfrmProductionAnPaiNew.FormCreate(Sender: TObject);
begin
cxGrid1.Align:=alClient;
if Trim(DParameters1)='<27><><EFBFBD><EFBFBD>' then
begin
Button5.Visible:=True;
Button4.Visible:=True;
end else
begin
Button5.Visible:=False;
Button4.Visible:=False;
end;
end;
procedure TfrmProductionAnPaiNew.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add(' exec P_ProductAnPai :begdate,:enddate,:pstate,:Wsql');
if cxTabControl1.TabIndex=0 then
begin
Parameters.ParamByName('begdate').Value:='';
Parameters.ParamByName('enddate').Value:='';
Parameters.ParamByName('pstate').Value:=1;
end else
if cxTabControl1.TabIndex=1 then
begin
Parameters.ParamByName('begdate').Value:='';
Parameters.ParamByName('enddate').Value:='';
Parameters.ParamByName('pstate').Value:=2;
end else
if cxTabControl1.TabIndex=2 then
begin
Parameters.ParamByName('begdate').Value:=FormatDateTime('yyyy-MM-dd',BegDate.Date) ;
Parameters.ParamByName('enddate').Value:=FormatDateTime('yyyy-MM-dd',EndDate.Date+1);
Parameters.ParamByName('pstate').Value:=3;
end;
Parameters.ParamByName('Wsql').Value:='';
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmProductionAnPaiNew.InitGridAnPai();
begin
try
ADOQuerySub.DisableControls;
with ADOQuerySub do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('select A.*,C.OrderNo,B.SWFBCodeName,B.SWFBColor,B.SWFBHW,B.SWFBKZ ');
sql.Add(',SCMQty=(select isnull(sum(MJLen),0) from WFB_MJJY AA where AA.APID=A.APID)');
sql.Add(',Case when A.OrderQtyM-(select isnull(sum(MJLen),0) from WFB_MJJY AA where AA.APID=A.APID)>0 then');
SQL.Add(' A.OrderQtyM-(select isnull(sum(MJLen),0) from WFB_MJJY AA where AA.APID=A.APID) else 0 end as WSCMQty');
SQL.Add('from WFBOrder_Sub_AnPai A inner join WFBOrder_Sub B on A.SubId=B.SubId');
sql.Add(' inner join WFBOrder_Main C on A.MainId=C.MainId');
sql.Add(' where A.SubId='''+Trim(CDS_Main.fieldbyname('SubId').AsString)+'''');
if cxTabControl1.TabIndex=1 then
begin
SQL.Add(' and Isnull(A.SCStatus,'''')<>''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
end else
if cxTabControl1.TabIndex=2 then
begin
SQL.Add(' and Isnull(A.SCStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
end;
Open;
end;
SCreateCDS20(ADOQuerySub,CDS_SCAnPai);
SInitCDSData20(ADOQuerySub,CDS_SCAnPai);
finally
ADOQuerySub.EnableControls;
end;
end;
procedure TfrmProductionAnPaiNew.Button1Click(Sender: TObject);
begin
orderno.SetFocus;
InitGrid();
InitGridAnPai();
end;
procedure TfrmProductionAnPaiNew.FormShow(Sender: TObject);
begin
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FD1',Tv1,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FD2',Tv2,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
EndDate.Date:=SGetServerDate(ADOQueryTemp);
BegDate.Date:=EndDate.Date-30;
if cxTabControl1.TabIndex=1 then
begin
Tv2.OptionsSelection.CellSelect:=False;
end else
Tv2.OptionsSelection.CellSelect:=True;
if Trim(DParameters1)='<27><><EFBFBD><EFBFBD>' then
begin
Tv2.OptionsSelection.CellSelect:=False;
end;
InitGrid();
InitGridAnPai();
end;
procedure TfrmProductionAnPaiNew.ordernoChange(Sender: TObject);
begin
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
end;
procedure TfrmProductionAnPaiNew.v1Column4PropertiesEditValueChanged(
Sender: TObject);
var
mvalue:String;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
with CDS_SCAnPai do
begin
Edit;
FieldByName('SCOrder').Value:=Trim(mvalue);
FieldByName('AnPaiDate').Value:=Now;
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate WFBOrder_Sub_AnPai Set SCOrder='''+Trim(mvalue)+'''');
SQL.Add(',AnPaiDate=getdate()');
SQL.Add(' where APId='''+Trim(CDS_SCAnPai.fieldbyname('APId').AsString)+'''');
ExecSQL;
end;
end;
procedure TfrmProductionAnPaiNew.Button2Click(Sender: TObject);
begin
orderno.SetFocus;
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FD1',Tv1,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FD2',Tv2,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Close;
end;
procedure TfrmProductionAnPaiNew.Button3Click(Sender: TObject);
begin
if CDS_Main.IsEmpty then Exit;
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',cxGrid1);
end;
procedure TfrmProductionAnPaiNew.cxTabControl1Change(Sender: TObject);
begin
InitGrid();
InitGridAnPai();
if cxTabControl1.TabIndex=0 then
begin
Tv2.OptionsSelection.CellSelect:=True;
end else
Tv2.OptionsSelection.CellSelect:=False;
if Trim(DParameters1)='<27><><EFBFBD><EFBFBD>' then
begin
Tv2.OptionsSelection.CellSelect:=False;
end;
VisbleControl(Panel2,False,Panel2.ControlCount);
end;
procedure TfrmProductionAnPaiNew.Button4Click(Sender: TObject);
begin
if cxTabControl1.TabIndex<>0 then Exit;
if CDS_SCAnPai.IsEmpty then Exit;
if Trim(DName)=Trim(CDS_Main.fieldbyname('AnPaiPerson').AsString) then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate WFBOrder_Sub Set AnPaiChker='''+Trim(DName)+'''');
sql.Add(',AnPaiChkStatus=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>''');
sql.add(',AnPaiChkDate=getdate()');
SQL.Add(' where SubId='''+Trim(CDS_Main.fieldbyname('SubId').AsString)+'''');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
CDS_Main.Delete;
InitGridAnPai();
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
Exit;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>','<27><>ʾ',0);
end;
end;
procedure TfrmProductionAnPaiNew.Button5Click(Sender: TObject);
begin
if cxTabControl1.TabIndex<>1 then Exit;
if Trim(DName)=Trim(CDS_Main.fieldbyname('AnPaiPerson').AsString) then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate WFBOrder_Sub Set AnPaiChker='''+Trim(DName)+'''');
sql.Add(',AnPaiChkStatus=''<27><><EFBFBD>˲<EFBFBD>ͨ<EFBFBD><CDA8>'',');
sql.add('AnPaiChkDate=getdate()');
SQL.Add(' where SubId='''+Trim(CDS_Main.fieldbyname('SubId').AsString)+'''');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
CDS_Main.Delete;
InitGridAnPai();
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
Exit;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>','<27><>ʾ',0);
end;
end;
procedure TfrmProductionAnPaiNew.Tv1DblClick(Sender: TObject);
begin
try
frmOrderAttachment:=TfrmOrderAttachment.Create(Application);
with frmOrderAttachment do
begin
FAMainId:=Trim(Self.CDS_Main.fieldbyname('MainId').AsString);
Panel1.Enabled:=False;
if ShowModal=1 then
begin
end;
end;
finally
frmOrderAttachment.Free;
end;
end;
procedure TfrmProductionAnPaiNew.v1Column19PropertiesEditValueChanged(
Sender: TObject);
var
mvalue,FFieldName:String;
i:Integer;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
if Trim(mvalue)='' then
mvalue:='0';
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
with CDS_SCAnPai do
begin
Edit;
FieldByName(FFieldName).Value:=Trim(mvalue);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate WFBOrder_Sub_AnPai Set '+FFieldName+'='+Trim(mvalue));
SQL.Add(',AnPaiPerson='''+Trim(DName)+'''');
SQL.Add(' where APId='''+Trim(CDS_SCAnPai.fieldbyname('APId').AsString)+'''');
ExecSQL;
end;
if Trim(FFieldName)='SmalCount' then
begin
VisbleControl(Panel2,False,Panel2.ControlCount);
VisbleControl(Panel2,True,strtoint(mvalue)+1);
end;
if strtoint(mvalue)+1>0 then
begin
Button6.Visible:=True;
end;
end;
procedure TfrmProductionAnPaiNew.v1Column23PropertiesEditValueChanged(
Sender: TObject);
var
mvalue:String;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
if Trim(mvalue)='' then
mvalue:='';
with CDS_SCAnPai do
begin
Edit;
FieldByName('SmalPC').Value:=Trim(mvalue);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate WFBOrder_Sub_AnPai Set SmalPC='''+Trim(mvalue)+'''');
SQL.Add(' where APId='''+Trim(CDS_SCAnPai.fieldbyname('APId').AsString)+'''');
ExecSQL;
end;
end;
procedure TfrmProductionAnPaiNew.VisbleControl(Panel55:TWinControl;XS:Boolean;SXCount:Integer);
var
i:Integer;
begin
with Panel55 do
begin
for i:=0 to SXCount-1 do
begin
Controls[i].Visible:=XS;
end;
end;
end;
procedure TfrmProductionAnPaiNew.Button6Click(Sender: TObject);
var
i,j:Integer;
FFname,FFnameValue,FSubId:string;
begin
//FSubId:=Trim(CDS_Main.fieldbyname('SubId').AsString);
try
j:=0;
ADOQueryCmd.Connection.BeginTrans;
with Panel2 do
begin
for i:=0 to Panel2.ControlCount-1 do
begin
if Controls[i] is TLabel then Continue;
if Controls[i] is TButton then Continue;
if Controls[i].Visible=True then
begin
FFname:=Trim(Controls[i].Name);
if Trim(TEdit(Controls[i]).Text)='' then
begin
ADOQueryCmd.Connection.RollbackTrans;
j:=9;
Break;
end;
if StrToFloat((TEdit(Controls[i]).Text))=0 then
begin
ADOQueryCmd.Connection.RollbackTrans;
j:=10;
Break;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFBOrder_Sub_AnPai Set '+FFname+'='+Trim(TEdit(Controls[i]).Text));
SQL.Add(' where APId='''+Trim(CDS_SCAnPai.fieldbyname('APId').AsString)+'''');
ExecSQL;
end;
with CDS_SCAnPai do
begin
Edit;
FieldByName(Controls[i].Name).Value:=Trim(TEdit(Controls[i]).Text);
Post;
end;
end;
end;
if j=0 then
ADOQueryCmd.Connection.CommitTrans
else
if j=9 then
begin
//ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end else
if j=10 then
begin
//ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>㣡','<27><>ʾ',0);
Exit;
end;
end;
//InitGrid();
// CDS_Main.Locate('SubId',Trim(FSubId),[]);
with Panel2 do
begin
j:=0;
for i:=0 to Panel2.ControlCount-1 do
begin
if Controls[i] is TLabel then Continue;
if Controls[i] is TButton then Continue;
if TEdit(Controls[i]).Visible=True then
begin
if j=0 then
FSubId:=Trim(TEdit(Controls[i]).Text)
else
FSubId:=FSubId+','+Trim(TEdit(Controls[i]).Text);
j:=j+1;
end;
end;
end;
with CDS_SCAnPai do
begin
Edit;
FieldByName('SmalMF').Value:=Trim(FSubId);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFBOrder_Sub_Anpai Set SmalMF='''+Trim(FSubId)+'''') ;
sql.Add(' where APID='''+Trim(CDS_SCAnPai.fieldbyname('APID').AsString)+'''');
ExecSQL;
end;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8B7><EFBFBD><EFBFBD><ECB3A3>','<27><>ʾ',0);
end;
end;
procedure TfrmProductionAnPaiNew.v1Column24PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
var
mvalue:String;
begin
mvalue:=Trim(CDS_Main.fieldbyname('SmalNote').AsString);
try
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
with frmZDYHelpSel do
begin
flag:='SmalNote';
flagname:='<27><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>';
if ShowModal=1 then
begin
with Self.CDS_SCAnPai do
begin
Edit;
FieldByName('SmalNote').Value:=mvalue+Trim(ReturnStr);
//post;
end;
mvalue:=mvalue+ReturnStr;
with Self.ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('UPdate WFBOrder_Sub_AnPai Set SmalNote='''+Trim(mvalue)+'''');
SQL.Add(' where APId='''+Trim(CDS_SCAnPai.fieldbyname('APId').AsString)+'''');
ExecSQL;
end;
end;
end;
finally
end;
end;
procedure TfrmProductionAnPaiNew.v1Column24PropertiesEditValueChanged(
Sender: TObject);
var
mvalue:String;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
if Trim(mvalue)='' then
mvalue:='';
with CDS_SCAnPai do
begin
Edit;
FieldByName('SmalNote').Value:=Trim(mvalue);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate WFBOrder_Sub_AnPai Set SmalNote='''+Trim(mvalue)+'''');
SQL.Add(' where APId='''+Trim(CDS_SCAnPai.fieldbyname('APID').AsString)+'''');
ExecSQL;
end;
end;
procedure TfrmProductionAnPaiNew.v1Column25PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
var
mvalue:String;
begin
mvalue:=Trim(CDS_Main.fieldbyname('DBNote').AsString);
try
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
with frmZDYHelpSel do
begin
flag:='DBNote';
flagname:='<27><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>';
if ShowModal=1 then
begin
with Self.CDS_SCAnPai do
begin
Edit;
FieldByName('DBNote').Value:=mvalue+Trim(ReturnStr);
//post;
end;
mvalue:=mvalue+ReturnStr;
with Self.ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('UPdate WFBOrder_Sub_AnPai Set DBNote='''+Trim(mvalue)+'''');
SQL.Add(' where APId='''+Trim(CDS_SCAnPai.fieldbyname('APId').AsString)+'''');
ExecSQL;
end;
end;
end;
finally
end;
end;
procedure TfrmProductionAnPaiNew.v1Column25PropertiesEditValueChanged(
Sender: TObject);
var
mvalue:String;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
if Trim(mvalue)='' then
mvalue:='';
with CDS_SCAnPai do
begin
Edit;
FieldByName('DBNote').Value:=Trim(mvalue);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate WFBOrder_Sub_AnPai Set DBNote='''+Trim(mvalue)+'''');
SQL.Add(' where ApId='''+Trim(CDS_SCAnPai.fieldbyname('ApId').AsString)+'''');
ExecSQL;
end;
end;
procedure TfrmProductionAnPaiNew.Button7Click(Sender: TObject);
begin
try
frmJiangLiaoSet:=TfrmJiangLiaoSet.Create(Application);
with frmJiangLiaoSet do
begin
if ShowModal=1 then
begin
end;
end;
finally
end;
end;
procedure TfrmProductionAnPaiNew.N1Click(Sender: TObject);
var
maxno:String;
begin
if cxTabControl1.TabIndex>0 then Exit;
try
ADOQueryCmd.Connection.BeginTrans;
if GetLSNo(ADOQueryCmd,maxno,'AP','WFBOrder_Sub_AnPai',3,1)=False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFBOrder_Sub_AnPai where 1<>1');
Open;
end;
with ADOQueryCmd do
begin
Append;
FieldByName('APID').Value:=Trim(maxno);
FieldByName('MainId').Value:=Trim(CDS_Main.fieldbyname('MainId').AsString);
FieldByName('SubId').Value:=Trim(CDS_Main.fieldbyname('SubId').AsString);
FieldByName('AnPaiPerson').Value:=Trim(DName);
FieldByName('SmalCount').Value:=0;
FieldByName('AnPaiDate').Value:=SGetServerDate(ADOQueryTemp);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFBOrder_Sub Set AnPaiPerson='''+Trim(DName)+'''');
sql.Add(',AnPaiDate=getdate()');
SQL.Add(' where SubId='''+Trim(CDS_Main.fieldbyname('SubId').AsString)+'''');
ExecSQL;
end;
with CDS_Main do
begin
Edit;
FieldByName('AnPaiPerson').Value:=Trim(DName);
Post;
end;
with CDS_SCAnPai do
begin
Append;
FieldByName('APID').Value:=Trim(maxno);
FieldByName('MainId').Value:=Trim(CDS_Main.fieldbyname('MainId').AsString);
FieldByName('SubId').Value:=Trim(CDS_Main.fieldbyname('SubId').AsString);
FieldByName('AnPaiDate').Value:=SGetServerDate(ADOQueryTemp);
FieldByName('SmalCount').Value:=0;
FieldByName('OrderNo').Value:=Trim(CDS_Main.fieldbyname('OrderNo').AsString);
FieldByName('SWFBColor').Value:=Trim(CDS_Main.fieldbyname('SWFBColor').AsString);
FieldByName('SWFBKZ').Value:=Trim(CDS_Main.fieldbyname('SWFBKZ').AsString);
FieldByName('SWFBHW').Value:=Trim(CDS_Main.fieldbyname('SWFBHW').AsString);
FieldByName('SmalMF1').Value:=0;
FieldByName('SmalMF2').Value:=0;
FieldByName('SmalMF3').Value:=0;
FieldByName('SmalMF4').Value:=0;
FieldByName('SmalMF5').Value:=0;
FieldByName('SmalMF6').Value:=0;
FieldByName('SmalMF7').Value:=0;
FieldByName('SmalMF8').Value:=0;
FieldByName('SmalMF9').Value:=0;
FieldByName('SmalMF10').Value:=0;
FieldByName('SmalMF11').Value:=0;
FieldByName('SmalMF12').Value:=0;
Post;
end;
ADOQueryCmd.Connection.CommitTrans;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>','<27><>ʾ',0);
Exit;
end;
end;
procedure TfrmProductionAnPaiNew.N2Click(Sender: TObject);
begin
if cxTabControl1.TabIndex>0 then Exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete WFBOrder_Sub_AnPai where APID='''+Trim(CDS_SCAnPai.fieldbyname('APID').AsString)+'''');
ExecSQL;
end;
CDS_SCAnPai.Delete;
end;
procedure TfrmProductionAnPaiNew.Tv2CellClick(
Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
begin
VisbleControl(Panel2,False,Panel2.ControlCount);
VisbleControl(Panel2,True,CDS_SCAnPai.fieldbyname('SmalCount').Value+1);
if Trim(CDS_SCAnPai.FieldByName('SmalCount').AsString)='' then Exit;
if CDS_SCAnPai.fieldbyname('SmalCount').Value>0 then
begin
SCSHDataCDS(CDS_SCAnPai,Panel2,2);
if cxTabControl1.TabIndex=0 then
Button6.Visible:=True
else
Button6.Visible:=False;
end;
end;
procedure TfrmProductionAnPaiNew.Tv1CellClick(
Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
begin
InitGridAnPai();
end;
procedure TfrmProductionAnPaiNew.v2Column5PropertiesEditValueChanged(
Sender: TObject);
var
mvalue:String;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
if Trim(mvalue)='' then
mvalue:='';
with CDS_SCAnPai do
begin
Edit;
FieldByName('WeigthNote').Value:=Trim(mvalue);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate WFBOrder_Sub_AnPai Set WeigthNote='''+Trim(mvalue)+'''');
SQL.Add(' where APId='''+Trim(CDS_SCAnPai.fieldbyname('APId').AsString)+'''');
ExecSQL;
end;
end;
procedure TfrmProductionAnPaiNew.v2Column6PropertiesEditValueChanged(
Sender: TObject);
var
mvalue:String;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
if Trim(mvalue)='' then
mvalue:='';
with CDS_SCAnPai do
begin
Edit;
FieldByName('APNote').Value:=Trim(mvalue);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate WFBOrder_Sub_AnPai Set APNote='''+Trim(mvalue)+'''');
SQL.Add(' where APId='''+Trim(CDS_SCAnPai.fieldbyname('APId').AsString)+'''');
ExecSQL;
end;
end;
procedure TfrmProductionAnPaiNew.Button10Click(Sender: TObject);
begin
if cxTabControl1.TabIndex<>1 then Exit;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA><D6B4><EFBFBD><EFBFBD><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFBOrder_Sub_AnPai Set SCStatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',WCDate=getdate() where APID='''+Trim(CDS_SCAnPai.fieldbyname('APID').AsString)+'''');
ExecSQL;
end;
CDS_SCAnPai.Delete;
end;
procedure TfrmProductionAnPaiNew.Button11Click(Sender: TObject);
begin
if cxTabControl1.TabIndex<>2 then Exit;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA><D6B4><EFBFBD><EFBFBD><EFBFBD>ɳ<EFBFBD><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFBOrder_Sub_AnPai Set SCStatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' where APID='''+Trim(CDS_SCAnPai.fieldbyname('APID').AsString)+'''');
ExecSQL;
end;
CDS_SCAnPai.Delete;
end;
procedure TfrmProductionAnPaiNew.Button9Click(Sender: TObject);
begin
if cxTabControl1.TabIndex<>1 then Exit;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFBOrder_Sub_AnPai Set SCXDFlag=1 where APID='''+Trim(CDS_SCAnPai.fieldbyname('APID').AsString)+'''');
ExecSQL;
end;
with CDS_SCAnPai do
begin
Edit;
FieldByName('SCXDFlag').Value:=True;
Post;
end;
end;
procedure TfrmProductionAnPaiNew.Button8Click(Sender: TObject);
begin
if cxTabControl1.TabIndex<>1 then Exit;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFBOrder_Sub_AnPai Set SCXDFlag=0 where APID='''+Trim(CDS_SCAnPai.fieldbyname('APID').AsString)+'''');
ExecSQL;
end;
with CDS_SCAnPai do
begin
Edit;
FieldByName('SCXDFlag').Value:=false;
Post;
end;
end;
procedure TfrmProductionAnPaiNew.v2Column8PropertiesEditValueChanged(
Sender: TObject);
var
mvalue:TDateTime;
begin
mvalue:=TcxDateEdit(Sender).EditingValue;
if Trim(DateTimeToStr(mvalue))='' then
begin
mvalue:=null;
end;
with CDS_SCAnPai do
begin
Edit;
FieldByName('WCDate').Value:=mvalue;
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate WFBOrder_Sub_AnPai Set WCDate='''+Trim(FormatDateTime('yyyy-MM-dd HH:mm:ss',mvalue))+'''');
SQL.Add(' where APId='''+Trim(CDS_SCAnPai.fieldbyname('APId').AsString)+'''');
ExecSQL;
end;
end;
end.