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

1111 lines
34 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_JYOrderCDOne_Other;
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, cxCheckBox, cxCalendar, cxSplitter,
RM_Dataset, RM_System, RM_Common, RM_Class, RM_GridReport, RM_e_Xls,
Menus, MovePanel,strUtils;
type
TfrmJYOrderCDOne_other = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Label1: TLabel;
Tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
Label3: TLabel;
OrderNo: TEdit;
TBExport: TToolButton;
Order_Main: TClientDataSet;
MPRTMF: TEdit;
Label7: TLabel;
C_Color: TEdit;
Label8: TLabel;
Label9: TLabel;
BCgangNO: TEdit;
Label10: TLabel;
MJID: TEdit;
Label2: TLabel;
CDQK: TEdit;
Panel4: TPanel;
Label11: TLabel;
Panel10: TPanel;
Image2: TImage;
RichEdit1: TRichEdit;
v1Column2: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column11: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
Label4: TLabel;
MJType: TComboBox;
v1Column13: TcxGridDBColumn;
Label5: TLabel;
C_CodeName: TEdit;
Label6: TLabel;
MJStr2: TComboBox;
v1Column17: TcxGridDBColumn;
Label12: TLabel;
Label13: TLabel;
AOrddefstr6: TEdit;
v1Column20: TcxGridDBColumn;
v1Column21: TcxGridDBColumn;
Filler: TComboBox;
TBManage: TToolButton;
v1Column22: TcxGridDBColumn;
v1Column23: TcxGridDBColumn;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
TBZF: TToolButton;
ToolButton1: TToolButton;
RM2: TRMGridReport;
RMDB_Main: TRMDBDataSet;
ADOQueryPrint: TADOQuery;
TBAftChkHX: TToolButton;
RadioGroup1: TRadioGroup;
MovePanel2: TMovePanel;
Tsave: TToolButton;
CheckBox1: TCheckBox;
v1Column3: TcxGridDBColumn;
AOrddefstr4: TEdit;
Label14: TLabel;
v1Column5: TcxGridDBColumn;
TRK: TToolButton;
ADOQueryTmp: TADOQuery;
Label15: TLabel;
Label16: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure TBExportClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure OrderNoChange(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Panel10MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Image2Click(Sender: TObject);
procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure TBManageClick(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure TBZFClick(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure TBAftChkHXClick(Sender: TObject);
procedure BCgangNOChange(Sender: TObject);
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
procedure TsaveClick(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure Tv1CustomDrawIndicatorCell(Sender: TcxGridTableView;
ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo;
var ADone: Boolean);
procedure TRKClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Edit1Exit(Sender: TObject);
private
DQdate:TDateTime;
FLeft,FTop:Integer;
procedure InitGrid();
procedure InitGrid10();
procedure InitForm();
function Savedata():Boolean;
function SaveRK():Boolean;
{ Private declarations }
public
FFInt:Integer;
{ Public declarations }
end;
var
frmJYOrderCDOne_other: TfrmJYOrderCDOne_other;
implementation
uses
U_DataLink,U_OrderInPut,U_Fun,U_MJEdit, U_MJEdit_other;
{$R *.dfm}
function TfrmJYOrderCDOne_other.SaveRK():Boolean;
var
maxno:String;
CRID:Integer;
MaxCkNo,MaxCkSubNo:String;
MhcTime:TdateTime;
begin
Result:=false;
ADOQueryCmd.Connection.BeginTrans;
try
Order_Main.First;
Order_Main.DisableControls;
while not Order_Main.Eof do
begin
IF Order_Main.FieldByName('ssel').AsBoolean then
begin
with ADOQueryTmp do
begin
Close;
sql.Clear;
SQL.add('Update CK_BanCP_CRID1 Set CRID=CRID+1');
sql.Add('select * from CK_BanCP_CRID1');
Open;
end;
CRID:=ADOQueryTmp.fieldbyname('CRID').AsInteger;
if GetLSNo(ADOQueryTmp,MaxCkNo,'JT','CK_BanCP_CR1',4,1)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Order_Main.EnableControls;
Application.MessageBox(<><C8A1>Ʒ<EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from CK_BanCP_CR1 where 1<>1');
Open;
end;
mhcTime:=SGetServerDateTime(ADOQueryTmp);
with ADOQueryCmd do
begin
Append;
FieldByName('MainId').Value:=Trim(Order_Main.fieldbyname('MainId').AsString);
FieldByName('SubId').Value:=Trim(Order_Main.fieldbyname('SubId').AsString);
FieldByName('C_Code').Value:=Trim(Order_Main.fieldbyname('C_Code').AsString);
FieldByName('C_CodeName').Value:=Trim(Order_Main.fieldbyname('C_CodeName').AsString);
FieldByName('C_SPec').Value:=Trim(Order_Main.fieldbyname('C_SPec').AsString);
FieldByName('C_Color').Value:=Trim(Order_Main.fieldbyname('C_Color').AsString);
FieldByName('APID').Value:=Trim(Order_Main.fieldbyname('APID').AsString);
FieldByName('MJID').Value:=Trim(Order_Main.fieldbyname('MJId').AsString);
FieldByName('mjxh').Value:=Trim(Order_Main.fieldbyname('mjxh').AsString);
FieldByName('BCGangNO').Value:=Trim(Order_Main.fieldbyname('BCGangNO').AsString);
FieldByName('RCGangNO').Value:=Trim(Order_Main.fieldbyname('RCGangNO').AsString);
FieldByName('BCID').Value:=Trim(MaxCkNo);
FieldByName('CRTime').Value:=FormatDateTime('yyyy-MM-dd',mhcTime);
FieldByName('CRFlag').Value:='<27><><EFBFBD><EFBFBD>';
FieldByName('CRType').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('CRID').Value:=CRID;
FieldByName('KGQty').Value:=0;
FieldByName('Qty').Value:=Order_Main.fieldbyname('MJLen').Value;
FieldByName('RollNum').Value:=1;
FieldByName('QtyUnit').Value:=Order_Main.fieldbyname('MJTypeOther').Value;
FieldByName('CPType').Value:=Order_Main.fieldbyname('MJType').Value;
FieldByName('Note').Value:=Order_Main.fieldbyname('Note').Value;
FieldByName('Filler').Value:=Trim(DName);
FieldByName('FillTime').Value:=SGetServerDateTime(ADOQueryTmp);
// FieldByName('kcKw').Value:=Trim(kcKw.Text);
// fieldbyname('kcKw').Value:=GetKw(ADOQueryTmp,ADOQueryMain.fieldbyname('C_CodeName').AsString,ADOQueryMain.fieldbyname('C_Color').AsString);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from CK_BanCP_KC1 where 1<>1');
Open;
end;
with ADOQueryCmd do
begin
Append;
FieldByName('CRID').Value:=CRID;
FieldByName('BCID').Value:=Trim(MaxCkNo);
FieldByName('CRTime').Value:=FormatDateTime('yyyy-MM-dd',mhcTime);
FieldByName('CRType').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('CPType').Value:=Order_Main.fieldbyname('MJType').Value;
FieldByName('C_Code').Value:=Trim(Order_Main.fieldbyname('C_Code').AsString);
FieldByName('C_CodeName').Value:=Trim(Order_Main.fieldbyname('C_CodeName').AsString);
FieldByName('C_SPec').Value:=Trim(Order_Main.fieldbyname('C_SPec').AsString);
FieldByName('C_Color').Value:=Trim(Order_Main.fieldbyname('C_Color').AsString);
FieldByName('BCGangNO').Value:=Trim(Order_Main.fieldbyname('BCGangNO').AsString);
FieldByName('RCGangNO').Value:=Trim(Order_Main.fieldbyname('RCGangNO').AsString);
FieldByName('MJID').Value:=Trim(Order_Main.fieldbyname('MJID').AsString);
FieldByName('KCKGQty').Value:=0;
FieldByName('KCQty').Value:=Order_Main.fieldbyname('MJlen').Value;
FieldByName('KCRollNum').Value:=1;
FieldByName('KCQtyUnit').Value:=Order_Main.fieldbyname('MJTypeOther').Value;
FieldByName('mjxh').Value:=Trim(Order_Main.fieldbyname('mjxh').AsString);
FieldByName('KCNote').Value:=Order_Main.fieldbyname('Note').Value;
// FieldByName('kcKw').Value:=Trim(kcKw.Text);
// fieldbyname('kcKw').Value:=GetKw(ADOQueryTmp,ADOQueryMain.fieldbyname('C_CodeName').AsString,ADOQueryMain.fieldbyname('C_Color').AsString);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFB_MJJY1 Set MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' where MJID='''+Trim(Order_Main.fieldbyname('MJID').AsString)+'''');
ExecSQL;
end;
end;
Order_Main.Next;
end;
Order_Main.EnableControls;
ADOQueryCmd.Connection.CommitTrans;
Application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ');
Result:=true;
except
Order_Main.EnableControls;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
end;
end;
procedure TfrmJYOrderCDOne_other.FormDestroy(Sender: TObject);
begin
frmJYOrderCDOne_other:=nil;
end;
procedure TfrmJYOrderCDOne_other.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmJYOrderCDOne_other.FormCreate(Sender: TObject);
begin
cxgrid1.Align:=alClient;
DQdate:=SGetServerDate(ADOQueryTemp);
end;
procedure TfrmJYOrderCDOne_other.TBCloseClick(Sender: TObject);
begin
Close;
WriteCxGrid('<27><><EFBFBD><EFBFBD><E9B1A8>X',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmJYOrderCDOne_other.InitGrid();
var
i:integer;
j:Integer;
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('select A.*,case when A.MJQty1<>0 then 1 else 0 end as hc_RollNum, RollNum=1,CDQK='''' from WFB_MJJY1 A ');
sql.Add('where A.FillTime>='''+formatdateTime('yyyy-MM-dd',begdate.DateTime)+''' ');
sql.Add('and A.FillTime<'''+formatdateTime('yyyy-MM-dd',enddate.DateTime+1)+''' ');
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
TBFind.Click;
end;
end;
procedure TfrmJYOrderCDOne_other.InitGrid10();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('exec P_JYOrder_HZFX :begdate,:enddate,:PState ');
Parameters.ParamByName('begdate').Value:='2012-01-01';
Parameters.ParamByName('enddate').Value:='2011-01-01';
Parameters.ParamByName('PState').Value:=3;
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmJYOrderCDOne_other.InitForm();
var
fsj:String;
begin
ReadCxGrid('<27><><EFBFBD><EFBFBD><E9B1A8>X',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
fsj:='select distinct(Filler) name from WFB_MJJY1 ';
SInitComBoxBySql(ADOQueryCmd,Filler,False,fsj);
BegDate.DateTime:=SGetServerDate10(ADOQueryTemp);
EndDate.DateTime:=SGetServerDate10(ADOQueryTemp);
InitGrid();
end;
procedure TfrmJYOrderCDOne_other.TBFindClick(Sender: TObject);
var
fsj:String;
begin
if ADOQueryMain.Active=False then Exit;
if RadioGroup1.ItemIndex=0 then
begin
fsj:=' HXFlag=0 ';
end else
if RadioGroup1.ItemIndex=1 then
begin
fsj:=' HXFlag=1 ';
end else
if RadioGroup1.ItemIndex=0 then
begin
fsj:='';
end;
if Trim(SGetFilters(Panel1,1,2))='' then
begin
fsj:=fsj;
end else
begin
fsj:=SGetFilters(Panel1,1,2)+' and '+fsj;
end;
SDofilter(ADOQueryMain,fsj);
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
end;
procedure TfrmJYOrderCDOne_other.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then Exit;
SelExportData(Tv1,ADOQueryMain,'<27><><EFBFBD><EFBFBD><E9B1A8>');
end;
procedure TfrmJYOrderCDOne_other.TBRafreshClick(Sender: TObject);
begin
OrderNo.SetFocus;
MovePanel2.Visible:=True;
MovePanel2.Refresh;
InitGrid();
MovePanel2.Visible:=False;
end;
procedure TfrmJYOrderCDOne_other.OrderNoChange(Sender: TObject);
var
fsj:String;
begin
if ADOQueryMain.Active=False then Exit;
if Length(OrderNo.Text)<4 then Exit;
if RadioGroup1.ItemIndex=0 then
begin
fsj:=' HXFlag=0 ';
end else
if RadioGroup1.ItemIndex=1 then
begin
fsj:=' HXFlag=1 ';
end else
if RadioGroup1.ItemIndex=0 then
begin
fsj:='';
end;
if Trim(SGetFilters(Panel1,1,2))='' then
begin
fsj:=fsj;
end else
begin
fsj:=SGetFilters(Panel1,1,2)+' and '+fsj;
end;
SDofilter(ADOQueryMain,fsj);
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
end;
procedure TfrmJYOrderCDOne_other.FormShow(Sender: TObject);
begin
InitForm();
if Trim(DParameters2)='<27><><EFBFBD><EFBFBD>' then
begin
TBManage.Visible:=True;
TBZF.Visible:=True;
Tsave.Visible:=true;
//TBAftChkHX.Visible:=True;
end;
end;
procedure TfrmJYOrderCDOne_other.Panel10MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
TWinControl(Panel4).Perform(WM_SYSCOMMAND,$F012,0);
end;
procedure TfrmJYOrderCDOne_other.Image2Click(Sender: TObject);
begin
Panel4.Visible:=False;
end;
procedure TfrmJYOrderCDOne_other.Tv1MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FLeft:=X;
FTop:=Y;
end;
procedure TfrmJYOrderCDOne_other.Tv1CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
begin
Panel4.Left:=FLeft;
Panel4.Top:=FTop+110;
Panel4.Visible:=True;
Panel4.Refresh;
Panel10.Caption:=Trim(TV1.Controller.FocusedColumn.Caption);
RichEdit1.Text:=Order_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString;
end;
procedure TfrmJYOrderCDOne_other.TBManageClick(Sender: TObject);
begin
IF Order_Main.IsEmpty then exit;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_BanCP_CR1 where MJID='''+Trim(Order_Main.fieldbyname('MJID').AsString)+'''');
Open;
end;
if ADOQueryTemp.IsEmpty=False then
begin
Order_Main.EnableControls;
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܱ༭!','<27><>ʾ',0);
Exit;
end;
try
frmMJEdit_other:=TfrmMJEdit_other.Create(Application);
with frmMJEdit_other do
begin
MJID.Text:=Trim(Self.Order_Main.fieldbyname('MJID').AsString);
with ADOTmp do
begin
Close;
sql.Clear;
SQL.Add('select A.*,AOrddefstr3=(select AOrddefstr3 from JYOrder_Sub_AnPai B where B.APID=A.APID), ');
sql.Add('AOrddefstr2=(select AOrddefstr2 from JYOrder_Sub_AnPai B where B.APID=A.APID) from WFB_MJJY1 A');
sql.Add(' where A.MJID='''+Trim(MJID.Text)+'''');
Open;
end;
if ADOTmp.IsEmpty then
begin
MJID.Text:='';
Label2.Caption:='';
Label2.Visible:=False;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
MJMaoZ.Text:=Trim(ADOTmp.fieldbyname('MJMaoZ').AsString);
MJLen.Text:=Trim(ADOTmp.fieldbyname('MJLen').AsString);
MJQty1.Text:=Trim(ADOTmp.fieldbyname('MJQty1').AsString);
MJQty2.Text:=Trim(ADOTmp.fieldbyname('MJQty2').AsString);
MJFK.Text:=Trim(ADOTmp.fieldbyname('MJFK').AsString);
MJSJKZ.Text:=Trim(ADOTmp.fieldbyname('MJSJKZ').AsString);
M.Caption:=Trim(Trim(ADOTmp.fieldbyname('MJTypeOther').AsString));
Ma.Caption:=Trim(Trim(ADOTmp.fieldbyname('MJStr1').AsString));
if Trim(m.Caption)='' then
begin
m.Caption:=Trim(ADOTmp.fieldbyname('AOrddefstr3').AsString);
end;
if Trim(Ma.Caption)='' then
begin
Ma.Caption:=Trim(ADOTmp.fieldbyname('AOrddefstr2').AsString);
end;
if Trim(Trim(ADOTmp.fieldbyname('MJType').AsString))='<27><>Ʒ' then
begin
RadioGroup1.ItemIndex:=0
end else
if Trim(Trim(ADOTmp.fieldbyname('MJType').AsString))='<27><>Ʒ' then
begin
RadioGroup1.ItemIndex:=1;
end else
if Trim(Trim(ADOTmp.fieldbyname('MJType').AsString))='<27><><EFBFBD><EFBFBD>' then
begin
RadioGroup1.ItemIndex:=2;
end;
with ADOTmp do
begin
Close;
sql.Clear;
SQL.Add('select * from WFB_MJJY_CD1 A where A.MJID='''+Trim(MJID.Text)+'''');
Open;
end;
Label2.Caption:=Trim(MJID.Text);
Label2.Visible:=True;
MJID.Text:='';
SCreateCDS20(ADOTmp,Order_MJ);
SInitCDSData20(ADOTmp,Order_MJ);
if ShowModal=1 then
begin
end;
end;
finally
frmMJEdit_other.Free;
end;
end;
procedure TfrmJYOrderCDOne_other.N1Click(Sender: TObject);
begin
SelOKNo(Order_Main,True);
end;
procedure TfrmJYOrderCDOne_other.N2Click(Sender: TObject);
begin
SelOKNo(Order_Main,False);
end;
procedure TfrmJYOrderCDOne_other.TBZFClick(Sender: TObject);
var
strLog:string;
begin
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>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ<EFBFBD><CFBA><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ָܻ<DCBB><D6B8><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
Order_Main.DisableControls;
with Order_Main do
begin
First;
while not Eof do
begin
if Order_Main.FieldByName('SSel').AsBoolean=True then
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from CK_BanCP_CR1 where MJID='''+Trim(Order_Main.fieldbyname('MJID').AsString)+'''');
Open;
end;
if ADOQueryTemp.IsEmpty=False then
begin
Order_Main.EnableControls;
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!','<27><>ʾ',0);
Exit;
end else
begin
//begin
strLog:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+Trim(Order_Main.fieldbyname('APID').AsString)+
' <20><><EFBFBD><EFBFBD>:'+Trim(Order_Main.fieldbyname('MJID').AsString)+
' <20>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD>:'+Trim(Order_Main.fieldbyname('hc_RollNum').AsString)+
' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+Trim(Order_Main.fieldbyname('MJLen').AsString);
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete WFB_MJJY1 where MJID='''+Trim(Order_Main.fieldbyname('MJID').AsString)+'''');
// sql.Add('update JYOrder_Sub_AnPai_MX SET AOrdQty3=0 where APTm='''+Trim(Order_Main.fieldbyname('MJID').AsString)+'''');
sql.Add('delete WFB_MJJY_CD1 where MJID='''+Trim(Order_Main.fieldbyname('MJID').AsString)+'''');
// sql.Add('delete JYOrder_Sub_AnPai_MX where AOrdQty1=0 and APTm='''+Trim(Order_Main.fieldbyname('MJID').AsString)+'''');
// sql.Add('update JYOrder_Sub_AnPai SET AOrdQty1=(select sum(AOrdQty1) from JYOrder_Sub_AnPai_MX X where X.apid=JYOrder_Sub_AnPai.apid )');
// sql.Add('where APID='+quotedstr(trim(Order_Main.fieldbyname('APID').AsString)));
{ sql.Add('update YF_Money_CR SET Qty=(select sum(AOrdQty1) from JYOrder_Sub_AnPai X where X.apid=YF_Money_CR.YFTypeId )');
sql.Add('where YFTypeId='+quotedstr(trim(Order_Main.fieldbyname('APID').AsString)));
sql.Add('update YF_Money_CR SET Money=Price*Qty,BBMoney=Price*Qty ');
sql.Add('where YFTypeId='+quotedstr(trim(Order_Main.fieldbyname('APID').AsString)));
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( '); }
sql.Add(' '+quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(','+quotedstr(trim(self.Caption)));
sql.Add(','+quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>')));
sql.Add(','+quotedstr(trim(strLog)));
sql.Add(','+quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(')');
ExecSQL;
end;
// end;
end;
Order_Main.Delete;
end else
Next;
end;
end;
Order_Main.EnableControls;
end;
procedure TfrmJYOrderCDOne_other.ToolButton1Click(Sender: TObject);
var
fPrintFile:string;
Txt,fImagePath:string;
Moudle: THandle;
Makebar:TMakebar;
Mixtext:TMixtext;
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;
Order_Main.DisableControls;
with Order_Main do
begin
First;
while not Eof do
begin
if Order_Main.FieldByName('SSel').AsBoolean=True then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update WFB_MJJY1 Set PrtAgnFlag=1,PrtAgnDate=getdate(),PrtAgnPerson='''+Trim(DName)+'''');
sql.Add(' where MJID='''+Trim(Order_Main.fieldbyname('MJID').AsString)+'''');
ExecSQL;
end;
try
Moudle:=LoadLibrary('MakeQRBarcode.dll');
@Makebar:=GetProcAddress(Moudle,'Make');
@Mixtext:=GetProcAddress(Moudle,'MixText');
Txt:=Trim(Order_Main.fieldbyname('MJID').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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
Order_Main.EnableControls;
exit;
end;
with ADOQueryPrint do //Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>ж<EFBFBD>ȡ<EFBFBD><C8A1>Ҫ<EFBFBD>ڿͻ<DABF><CDBB>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ȡ<EFBFBD><C8A1>note<74>ֶΡ<D6B6>
begin
Close;
SQL.Clear;
sql.Add('select A.* ');
sql.Add(' from WFB_MJJY1 A') ;
SQL.Add(' where A.MJID='''+Trim(Order_Main.fieldbyname('MJID').AsString)+'''');
Open;
end;
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\ͨ<>ñ<EFBFBD>ǩ.rmf' ;
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE']:=fImagePath;
RM2.LoadFromFile(fPrintFile);
// RM2.ShowReport;
RM2.PrintReport;
end else
begin
Order_Main.EnableControls;
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><><EFBFBD><EFBFBD>ǩ.rmf'),'<27><>ʾ',0);
Exit;
end;
end;
Next;
end;
end;
Order_Main.EnableControls;
end;
procedure TfrmJYOrderCDOne_other.RadioGroup1Click(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmJYOrderCDOne_other.TBAftChkHXClick(Sender: TObject);
var
fsj,fsj10:String;
begin
if Order_Main.Locate('SSel',True,[])=False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
Order_Main.DisableControls;
with Order_Main do
begin
First;
while not Eof do
begin
if Order_Main.FieldByName('SSel').AsBoolean=True then
begin
if Trim(fsj)='' then
begin
fsj:=Trim(Order_Main.fieldbyname('SubId').AsString);
end
else
begin
if Trim(fsj)<>Trim(Order_Main.fieldbyname('SubId').AsString) then
begin
Order_Main.EnableControls;
Application.MessageBox('<27><>ͬ<EFBFBD><CDAC>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
end;
end;
Next;
end;
end;
Order_Main.EnableControls;
Order_Main.DisableControls;
with Order_Main do
begin
First;
while not Eof do
begin
if Order_Main.FieldByName('SSel').AsBoolean=True then
begin
if Trim(fsj10)='' then
begin
fsj10:=Trim(Order_Main.fieldbyname('AOrddefstr4').AsString);
end
else
begin
if Trim(fsj10)<>Trim(Order_Main.fieldbyname('AOrddefstr4').AsString) then
begin
Order_Main.EnableControls;
Application.MessageBox('<27><>ͬȾ<CDAC><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
end;
end;
Next;
end;
end;
Order_Main.EnableControls;
end;
function TfrmJYOrderCDOne_other.Savedata():Boolean;
var
maxno,LLID:string;
HXPS:Integer;
HXQty,HXMQty:Double;
begin
HXPS:=0;
HXQty:=0;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select Top 1 * from Contract_Cloth_LL where OrdSubId='''+Trim(Order_Main.fieldbyname('SubId').AsString)+'''');
sql.Add(' and FirstName='''+Trim(Order_Main.fieldbyname('AOrddefstr4').AsString)+'''');
Open;
end;
LLID:=Trim(ADOQueryTemp.fieldbyname('LLID').AsString);
if Trim(LLID)='' then
begin
Result:=False;
Application.MessageBox(<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ļӹ<C4BC><D3B9><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
try
ADOQueryCmd.Connection.BeginTrans;
if GetLSNo(ADOQueryCmd,maxno,'HX','Contract_Cloth_BefChkHX',2,1)=False then
begin
Result:=False;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
with Order_Main do
begin
First;
while not Eof do
begin
if Order_Main.FieldByName('SSel').AsBoolean=True then
begin
HXPS:=HXPS+1;
HXQty:=HXQty+Order_Main.FieldByName('MJLen').Value;
end;
Next;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('');
Open;
end;
except
end;
end;
procedure TfrmJYOrderCDOne_other.BCgangNOChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmJYOrderCDOne_other.OrderNoKeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
if Length(OrderNo.Text)<4 then Exit;
MovePanel2.Visible:=True;
MovePanel2.Refresh;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('exec P_JYOrder_HZFX :begdate,:enddate,:PState,:FFSql ');
Parameters.ParamByName('begdate').Value:='2010-01-01';
Parameters.ParamByName('enddate').Value:='2050-01-01';
Parameters.ParamByName('PState').Value:=3;
Parameters.ParamByName('FFSql').Value:=' where CC.OrderNo like '''+'%'+Trim(OrderNo.Text)+'%'+'''';
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
MovePanel2.Visible:=False;
end;
end;
procedure TfrmJYOrderCDOne_other.TsaveClick(Sender: TObject);
begin
IF Order_Main.IsEmpty then exit;
BegDate.SetFocus;
with Order_Main do
begin
DisableControls;
First;
while not Eof do
begin
IF fieldbyname('ssel').AsBoolean then
begin
iF trim(FieldByName('MJStr2').AsString)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
EnableControls;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end;
end;
Next;
end;
First;
EnableControls;
end;
ADOQueryCmd.Connection.BeginTrans;
try
with Order_Main do
begin
DisableControls;
First;
while not Eof do
begin
IF fieldbyname('ssel').AsBoolean then
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update WFB_MJJY1 SET mjQty1='+quotedstr(trim(Order_Main.fieldbyname('MJQty1').AsString)));
sql.Add(', mjlen='+quotedstr(trim(Order_Main.fieldbyname('mjlen').AsString)));
sql.Add('where MJID='+quotedstr(trim(Order_Main.fieldbyname('MJID').AsString)));
{ sql.Add('update JYOrder_Sub_AnPai_MX SET AOrdQty1='+quotedstr(trim(Order_Main.fieldbyname('MJQty1').AsString)));
sql.Add(', AOrdQty3='+quotedstr(trim(Order_Main.fieldbyname('mjlen').AsString)));
sql.Add('where APTM='+quotedstr(trim(Order_Main.fieldbyname('MJID').AsString)));
sql.Add('update JYOrder_Sub_AnPai SET AOrdQty1=(select sum(AOrdQty1) from JYOrder_Sub_AnPai_MX X where X.apid=JYOrder_Sub_AnPai.apid )');
sql.Add('where APID='+quotedstr(trim(Order_Main.fieldbyname('APID').AsString)));
sql.Add('update YF_Money_CR SET Qty=(select sum(AOrdQty1) from JYOrder_Sub_AnPai X where X.apid=YF_Money_CR.YFTypeId )');
sql.Add('where YFTypeId='+quotedstr(trim(Order_Main.fieldbyname('APID').AsString)));
sql.Add('update YF_Money_CR SET Money=Price*Qty,BBMoney=Price*Qty ');
sql.Add('where YFTypeId='+quotedstr(trim(Order_Main.fieldbyname('APID').AsString)));
sql.Add('delete WFB_MJJY where mjlen=0 and MJID='+quotedstr(trim(Order_Main.fieldbyname('MJID').AsString))); }
execsql;
end;
end;
Next;
end;
First;
EnableControls;
end;
ADOQueryCmd.Connection.CommitTrans;
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ');
InitGrid();
except
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
end;
end;
procedure TfrmJYOrderCDOne_other.CheckBox1Click(Sender: TObject);
begin
if Order_Main.IsEmpty then Exit;
with Order_Main do
begin
DisableControls;
First;
while not Eof do
begin
Edit;
FieldByName('SSel').Value:=CheckBox1.Checked;
Post;
Next;
end;
First;
EnableControls;
end;
end;
procedure TfrmJYOrderCDOne_other.Tv1CustomDrawIndicatorCell(
Sender: TcxGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
var
FValue: string;
FBounds: TRect;
begin
FBounds := AViewInfo.Bounds;
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
begin
ACanvas.FillRect(FBounds);
ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);
FValue :=IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index+1);
InflateRect(FBounds, -1, -1) ;
ACanvas.Font.Color := clBlack;
ACanvas.Brush.Style := bsClear;
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
ADone := True;
end;
end;
procedure TfrmJYOrderCDOne_other.TRKClick(Sender: TObject);
begin
IF Order_Main.IsEmpty then exit;
IF saveRk() then TBRafresh.Click;
end;
procedure TfrmJYOrderCDOne_other.Button1Click(Sender: TObject);
begin
IF Order_Main.IsEmpty then exit;
BegDate.SetFocus;
IF trim(Edit1.Text)='' then
begin
application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end;
IF trim(Edit2.Text)='' then
begin
application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end;
with Order_Main do
begin
DisableControls;
First;
while not Eof do
begin
IF fieldbyname('ssel').AsBoolean then
begin
iF trim(FieldByName('MJStr2').AsString)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
EnableControls;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end;
end;
Next;
end;
First;
EnableControls;
end;
ADOQueryCmd.Connection.BeginTrans;
try
with Order_Main do
begin
DisableControls;
First;
while not Eof do
begin
IF fieldbyname('ssel').AsBoolean then
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update WFB_MJJY1 SET C_CodeName='+quotedstr(trim(edit1.text)));
sql.Add(', C_Color='+quotedstr(trim(edit2.Text)));
sql.Add('where MJID='+quotedstr(trim(Order_Main.fieldbyname('MJID').AsString)));
{ sql.Add('update JYOrder_Sub_AnPai_MX SET AOrdQty1='+quotedstr(trim(Order_Main.fieldbyname('MJQty1').AsString)));
sql.Add(', AOrdQty3='+quotedstr(trim(Order_Main.fieldbyname('mjlen').AsString)));
sql.Add('where APTM='+quotedstr(trim(Order_Main.fieldbyname('MJID').AsString)));
sql.Add('update JYOrder_Sub_AnPai SET AOrdQty1=(select sum(AOrdQty1) from JYOrder_Sub_AnPai_MX X where X.apid=JYOrder_Sub_AnPai.apid )');
sql.Add('where APID='+quotedstr(trim(Order_Main.fieldbyname('APID').AsString)));
sql.Add('update YF_Money_CR SET Qty=(select sum(AOrdQty1) from JYOrder_Sub_AnPai X where X.apid=YF_Money_CR.YFTypeId )');
sql.Add('where YFTypeId='+quotedstr(trim(Order_Main.fieldbyname('APID').AsString)));
sql.Add('update YF_Money_CR SET Money=Price*Qty,BBMoney=Price*Qty ');
sql.Add('where YFTypeId='+quotedstr(trim(Order_Main.fieldbyname('APID').AsString)));
sql.Add('delete WFB_MJJY where mjlen=0 and MJID='+quotedstr(trim(Order_Main.fieldbyname('MJID').AsString))); }
execsql;
end;
end;
Next;
end;
First;
EnableControls;
end;
ADOQueryCmd.Connection.CommitTrans;
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ');
InitGrid();
except
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
end;
end;
procedure TfrmJYOrderCDOne_other.Edit1Exit(Sender: TObject);
var
mvalue:string;
begin
mvalue:=TEdit(Sender).Text;
IF trim(mvalue)='' then exit;
IF rightBstr(trim(mvalue),1)<>'#'THEN
BEGIn
mvalue:=trim(mvalue)+'#';
END;
TEdit(Sender).Text:= mvalue;
end;
end.