805 lines
22 KiB
ObjectPascal
805 lines
22 KiB
ObjectPascal
unit U_LLRKInPutMH_PBCK;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
|
||
cxGridTableView, cxGridDBTableView, cxClasses, cxControls,
|
||
cxGridCustomView, cxGrid, cxMemo, cxRichEdit, ComCtrls, cxContainer,
|
||
cxTextEdit, cxMaskEdit, cxButtonEdit, StdCtrls, ToolWin, DBClient, ADODB,
|
||
ExtCtrls, BtnEdit, cxCalendar,StrUtils, cxDropDownEdit,jpeg,
|
||
IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdFTP, cxPC,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxGroupBox, cxCheckBox,
|
||
RM_Dataset, RM_System, RM_Common, RM_Class, RM_GridReport,IniFiles, Menus,
|
||
ImgList,ShellAPI;
|
||
|
||
type
|
||
TfrmLLRKInPutMH_PBCK = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBClose: TToolButton;
|
||
ADOTemp: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
ADOQuery1: TADOQuery;
|
||
TBSave: TToolButton;
|
||
DataSource1: TDataSource;
|
||
ClientDataSet1: TClientDataSet;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
Label21: TLabel;
|
||
Label26: TLabel;
|
||
Label19: TLabel;
|
||
CDS_Print: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
Panel3: TPanel;
|
||
labMYType: TLabel;
|
||
Panel4: TPanel;
|
||
Panel5: TPanel;
|
||
Label31: TLabel;
|
||
Label32: TLabel;
|
||
PS: TEdit;
|
||
Qty: TEdit;
|
||
KgQty: TEdit;
|
||
Panel7: TPanel;
|
||
Panel1: TPanel;
|
||
Label20: TLabel;
|
||
PTID: TEdit;
|
||
ODPat: TOpenDialog;
|
||
IdFTP1: TIdFTP;
|
||
SaveDialog1: TSaveDialog;
|
||
adoqueryPicture: TADOQuery;
|
||
Label23: TLabel;
|
||
MYPrice: TEdit;
|
||
Panel16: TPanel;
|
||
Label24: TLabel;
|
||
Panel6: TPanel;
|
||
Panel11: TPanel;
|
||
Label46: TLabel;
|
||
Label47: TLabel;
|
||
Label48: TLabel;
|
||
ComboBox2: TComboBox;
|
||
ComboBox1: TComboBox;
|
||
BtnPrt: TButton;
|
||
BtnQX: TButton;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DataSource2: TDataSource;
|
||
PopupMenu2: TPopupMenu;
|
||
MenuItem1: TMenuItem;
|
||
N3: TMenuItem;
|
||
MenuItem2: TMenuItem;
|
||
N4: TMenuItem;
|
||
ImageList1: TImageList;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryTmp: TADOQuery;
|
||
Label33: TLabel;
|
||
JCDanWei: TBtnEditA;
|
||
JCNo: TEdit;
|
||
N5: TMenuItem;
|
||
N6: TMenuItem;
|
||
N7: TMenuItem;
|
||
ADOQuery2: TADOQuery;
|
||
Label45: TLabel;
|
||
Label50: TLabel;
|
||
Label1: TLabel;
|
||
Note: TEdit;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1JH: TcxGridDBColumn;
|
||
v1MXPrice: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1MXMoney: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1MXNote: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridDBColumn9: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Label2: TLabel;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
Edit1: TEdit;
|
||
Edit2: TEdit;
|
||
Edit3: TEdit;
|
||
ToolButton1: TToolButton;
|
||
Label22: TLabel;
|
||
MYCode: TEdit;
|
||
MYName: TBtnEditA;
|
||
Label13: TLabel;
|
||
CRTime: TDateTimePicker;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
ToolBar2: TToolBar;
|
||
Label6: TLabel;
|
||
ToolButton2: TToolButton;
|
||
ToolButton3: TToolButton;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure Image1DblClick(Sender: TObject);
|
||
procedure Panel1Click(Sender: TObject);
|
||
procedure Label20Click(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure BtnDelClick(Sender: TObject);
|
||
procedure BtnPrtClick(Sender: TObject);
|
||
procedure BtnQXClick(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure MYNameBtnClick(Sender: TObject);
|
||
procedure JCDanWeiBtnClick(Sender: TObject);
|
||
private
|
||
lstPat:TStringList;
|
||
FangXiang1,FSaveFlag:String;
|
||
procedure InitData();
|
||
procedure SaveImage(maxnoWB:String);
|
||
procedure ReadINIFile10();
|
||
function SaveData():Boolean;
|
||
procedure InitColor();
|
||
function SaveDataMX():Boolean;
|
||
procedure InitMXData();
|
||
procedure Initimage();
|
||
{ Private declarations }
|
||
public
|
||
canshu1:String;
|
||
PState,CopyInt:Integer;
|
||
FMainId:String;
|
||
FRead:String;
|
||
FMYType,FMYTypeFlag,FML:string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmLLRKInPutMH_PBCK: TfrmLLRKInPutMH_PBCK;
|
||
implementation
|
||
uses
|
||
U_DataLink,U_ZDYHelp,U_RTFun,U_ZDYHelpSel, U_GYSList,U_SCPerson,U_QCRKJLList,U_RSColorBig,
|
||
U_RTPTColor,U_KHListSelJJ,U_ZHCPBigTP,U_LLRKMXInPutMH,U_ZDYCPName,U_BPZdy_LRPB;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>1',Tv1,'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.Initimage();
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.InitData();
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select * ');
|
||
sql.Add(' from CK_MYSC_CR ');
|
||
sql.Add(' where MYID='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
SCSHDataNew(ADOQuery1,Panel4,2);
|
||
SCSHDataNew(ADOQuery1,Panel4,0);
|
||
SCSHDataNew(ADOQuery1,Panel5,2);
|
||
SCSHDataNew(ADOQuery1,Panel5,0);
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.InitMXData();
|
||
begin
|
||
with ADOQuery2 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,RCGangNo1=(case when isnull(RCGangNo,'''')='''' then GangNo else RCGangNo end)');
|
||
sql.Add(',Laster=isnull(Editer,Filler) from CK_MYSC_CR_MX A where isnull(MYID,'''')='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery2,ClientDataSet1);
|
||
SInitCDSData20(ADOQuery2,ClientDataSet1);
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.FormShow(Sender: TObject);
|
||
begin
|
||
InitData();
|
||
end;
|
||
|
||
function TfrmLLRKInPutMH_PBCK.SaveData():Boolean;
|
||
var
|
||
maxno,maxmxno,maxnoflag,fsj,FMXID:String;
|
||
begin
|
||
Result:=False;
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxno,'LL','CK_MYSC_CR',3,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
maxno:=Trim(maxno);
|
||
end else
|
||
begin
|
||
maxno:=Trim(FMainId);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from CK_MYSC_CR where MYId='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
Append;
|
||
end
|
||
else begin
|
||
Edit;
|
||
end;
|
||
FieldByName('MYId').Value:=Trim(maxno);
|
||
FieldByName('CRType').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('CRFlag').Value:='<27><><EFBFBD><EFBFBD>';
|
||
FieldByName('CRQtyFlag').Value:=-1;
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
FieldByName('FillerCode').Value:=Trim(DCode);
|
||
end else
|
||
begin
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditerCode').Value:=Trim(DCode);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
RTSetsavedata(ADOCmd,'CK_MYSC_CR',Panel4,2);
|
||
RTSetsavedata(ADOCmd,'CK_MYSC_CR',Panel5,2);
|
||
Post;
|
||
end;
|
||
FMainId:=Trim(maxno);
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('UPdate CK_MYSC_CR Set KHDayCS=isnull((select isnull(max(KHDayCS),0) from CK_MYSC_CR A ');
|
||
sql.Add(' where A.CRTime=CK_MYSC_CR.CRTime and A.MYType=CK_MYSC_CR.MYType and isnull(A.KHName,'''')=isnull(CK_MYSC_CR.KHName,'''')),0)+1');
|
||
SQL.Add('where MYID='''+Trim(FMainId)+''' and isnull(KHName,'''')<>'''' ');
|
||
sql.Add(' and isnull(KHDayCS,0)=0');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Update_LLRK_Qty :MYID');
|
||
Parameters.ParamByName('MYID').Value:=Trim(maxno);
|
||
ExecSQL;
|
||
end;
|
||
ADOCmd.Connection.CommitTrans;
|
||
FMainId:=Trim(maxno);
|
||
Result:=True;
|
||
except
|
||
Result:=False;
|
||
ClientDataSet1.EnableControls;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.TBSaveClick(Sender: TObject);
|
||
var
|
||
FReal:Double;
|
||
FInt:Integer;
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
if Trim(PS.Text)='' then
|
||
begin
|
||
Application.MessageBox('ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if TryStrToInt(PS.Text,FInt)=False then
|
||
begin
|
||
Application.MessageBox('ƥ<><C6A5><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
if (Trim(Qty.Text)='') and (Trim(KgQty.text)='') then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱΪ<CAB1><CEAA>!','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
if Trim(Qty.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(Qty.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
end;
|
||
if Trim(KgQty.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(KgQty.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
end;
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
|
||
ModalResult:=1;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.ReadINIFile10();
|
||
var
|
||
programIni:Tinifile; //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||
FileName:string;
|
||
begin
|
||
FileName:=ExtractFilePath(Paramstr(0))+'SYSTEMSET.INI';
|
||
programIni:=Tinifile.create(FileName);
|
||
server:=programIni.ReadString('SERVER','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ','127.0.0.1');
|
||
programIni.Free;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.SaveImage(maxnoWB:string);
|
||
begin
|
||
|
||
end;
|
||
|
||
Procedure TfrmLLRKInPutMH_PBCK.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
ModalResult:=1;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.InitColor();
|
||
var
|
||
fsj:string;
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from RT_PTColor where PTID='''+Trim(PTID.Text)+'''');
|
||
Open;
|
||
end;
|
||
fsj:=Trim(ADOTemp.fieldbyname('ColDaiMa').AsString);
|
||
if Trim(fsj)<>'' then
|
||
begin
|
||
//Panel6.Color:=StrToInt('$'+Trim(fsj));
|
||
end;
|
||
end;
|
||
procedure TfrmLLRKInPutMH_PBCK.FormCreate(Sender: TObject);
|
||
begin
|
||
lstPat := TStringList.Create;
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>1',Tv1,'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.Image1DblClick(Sender: TObject);
|
||
begin
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
Application.MessageBox('û<>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܲ鿴<DCB2><E9BFB4>ͼ!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
try
|
||
frmZHCPBigTP:=TfrmZHCPBigTP.Create(Application);
|
||
with frmZHCPBigTP do
|
||
begin
|
||
frmZHCPBigTP.FMainId:=Self.FMainId;
|
||
frmZHCPBigTP.FIMNO:='';
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZHCPBigTP.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.Panel1Click(Sender: TObject);
|
||
begin
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
Application.MessageBox('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','',0);
|
||
Exit;
|
||
end;
|
||
try
|
||
frmLLRKMXInPutMH:=TfrmLLRKMXInPutMH.Create(Application);
|
||
with frmLLRKMXInPutMH do
|
||
begin
|
||
PState:=1;
|
||
frmLLRKMXInPutMH.FMainId:=Trim(Self.FMainId);
|
||
if Self.TBSave.Visible=False then
|
||
begin
|
||
frmLLRKMXInPutMH.TBSave.Visible:=False;
|
||
end;
|
||
if ShowModal=1 then
|
||
begin
|
||
InitData();
|
||
end;
|
||
end;
|
||
finally
|
||
frmLLRKMXInPutMH.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.Label20Click(Sender: TObject);
|
||
begin
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
Application.MessageBox('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','',0);
|
||
Exit;
|
||
end;
|
||
try
|
||
frmLLRKMXInPutMH:=TfrmLLRKMXInPutMH.Create(Application);
|
||
with frmLLRKMXInPutMH do
|
||
begin
|
||
PState:=1;
|
||
frmLLRKMXInPutMH.FMainId:=Trim(Self.FMainId);
|
||
if Self.TBSave.Visible=False then
|
||
begin
|
||
frmLLRKMXInPutMH.TBSave.Visible:=False;
|
||
end;
|
||
if ShowModal=1 then
|
||
begin
|
||
InitData();
|
||
end;
|
||
end;
|
||
finally
|
||
frmLLRKMXInPutMH.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.Button1Click(Sender: TObject);
|
||
begin
|
||
Panel5.Visible:=True;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.BtnDelClick(Sender: TObject);
|
||
var
|
||
FFMXID:string;
|
||
begin
|
||
if ClientDataSet1.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
ClientDataSet1.DisableControls;
|
||
with ClientDataSet1 do
|
||
begin
|
||
first;
|
||
while ClientDataSet1.Locate('SSel',True,[]) do
|
||
begin
|
||
{with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from CK_MYSC_CR_MX where MXID='''+Trim(ClientDataSet1.fieldbyname('MXID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
FFMXID:=Trim(ADOTemp.fieldbyname('MXID').AsString);
|
||
if Trim(FFMXID)<>'' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' insert into CK_MYSC_CR_MX_Log ');
|
||
sql.Add(' select * from CK_MYSC_CR_MX where MXID='''+Trim(ClientDataSet1.fieldbyname('MXID').AsString)+'''');
|
||
sql.Add(' UPdate CK_MYSC_CR_MX_Log Set DelTime=getdate(),DelerCode='''+Trim(DCode)+''',Deler='''+Trim(DName)+'''');
|
||
sql.Add(' where MXID='''+Trim(ClientDataSet1.fieldbyname('MXID').AsString)+'''');
|
||
sql.Add(' Delete CK_MYSC_CR_MX where MXID='''+Trim(ClientDataSet1.fieldbyname('MXID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end; }
|
||
ClientDataSet1.Delete;
|
||
end;
|
||
end;
|
||
ClientDataSet1.EnableControls;
|
||
//if Trim(FMainId)<>'' then
|
||
begin
|
||
{with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Update_LLRK_Qty :MYID');
|
||
Parameters.ParamByName('MYID').Value:=Trim(FMainId);
|
||
ExecSQL;
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_MYSC_CR where MYID='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
SCSHDataNew(ADOTemp,Panel2,2);}
|
||
end;
|
||
ADOCmd.Connection.CommitTrans;
|
||
except
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.BtnPrtClick(Sender: TObject);
|
||
var
|
||
fPrintFile,Txt,fImagePath:string;
|
||
i,j:Integer;
|
||
Moudle: THandle;
|
||
Makebar:TMakebar;
|
||
Mixtext:TMixtext;
|
||
begin
|
||
if ClientDataSet1.Locate('GangNo',null,[])=true then
|
||
begin
|
||
Application.MessageBox('û<>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>棬<EFBFBD>ٴ<EFBFBD>ӡ<EFBFBD><D3A1>ǩ<EFBFBD><C7A9>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ClientDataSet1.Locate('SSel',True,[])=false then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3>ٴ<EFBFBD>ӡ<EFBFBD><D3A1>ǩ<EFBFBD><C7A9>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ComboBox2.Text='' then
|
||
begin
|
||
Application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ComboBox1.Text='' then
|
||
begin
|
||
Application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD>ߴ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ComboBox1.Text='9*7' then
|
||
begin
|
||
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<DEB7><C4B2><EFBFBD>ǩ97.rmf';
|
||
end else
|
||
if ComboBox1.Text='8*5' then
|
||
begin
|
||
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<DEB7><C4B2><EFBFBD>ǩ85.rmf';
|
||
end;
|
||
if FileExists(fPrintFile)=False then
|
||
begin
|
||
if ComboBox1.Text='9*7' then
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<DEB7><C4B2><EFBFBD>ǩ97.rmf'),'<27><>ʾ',0);
|
||
if ComboBox1.Text='8*5' then
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<DEB7><C4B2><EFBFBD>ǩ85.rmf'),'<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
ClientDataSet1.DisableControls;
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' Exec P_PRT_LLRK_ML :MXID');
|
||
Parameters.ParamByName('MXID').Value:=Trim(ClientDataSet1.fieldbyname('MXID').AsString);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOTemp,CDS_Print);
|
||
SInitCDSData20(ADOTemp,CDS_Print);
|
||
try
|
||
Moudle:=LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar:=GetProcAddress(Moudle,'Make');
|
||
@Mixtext:=GetProcAddress(Moudle,'MixText');
|
||
Txt:=Trim(ClientDataSet1.fieldbyname('MXID').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><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
Edit;
|
||
FieldByName('SSel').Value:=False;
|
||
RMVariables['QRBARCODE']:=fImagePath;
|
||
RM1.LoadFromFile(fPrintFile);
|
||
//RM1.ShowReport;
|
||
for i:=1 to StrToInt(ComboBox2.Text) do
|
||
begin
|
||
RM1.PrintReport;
|
||
end;
|
||
end;
|
||
end;
|
||
ClientDataSet1.EnableControls;
|
||
ComboBox2.ItemIndex:=0;
|
||
ComboBox1.ItemIndex:=-1;
|
||
Panel5.Visible:=False;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.BtnQXClick(Sender: TObject);
|
||
begin
|
||
Panel5.Visible:=False;
|
||
end;
|
||
|
||
function TfrmLLRKInPutMH_PBCK.SaveDataMX():Boolean;
|
||
var
|
||
maxmxno,maxnoflag,fsj,FMXID:String;
|
||
begin
|
||
Result:=False;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete from CK_MYSC_CR_MX where MYID='''+Trim(FMainId)+'''');
|
||
ExecSQL;
|
||
end;
|
||
try
|
||
ClientDataSet1.DisableControls;
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(FMXID)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxmxno,'LM','CK_MYSC_CR_MX',4,1)=False then
|
||
begin
|
||
ClientDataSet1.EnableControls;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
maxmxno:=maxmxno+'LML';
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_MYSC_CR_MX where MXID='''+Trim(maxmxno)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('MYID').Value:=Trim(FMainId);
|
||
FieldByName('MXID').Value:=Trim(maxmxno);
|
||
FieldByName('RCGangNo').Value:=ClientDataSet1.fieldbyname('RCGangNo').Value;
|
||
FieldByName('MXPrice').Value:=ClientDataSet1.fieldbyname('MXPrice').Value;
|
||
FieldByName('MXMoney').Value:=ClientDataSet1.fieldbyname('MXMoney').Value;
|
||
FieldByName('KgQty').Value:=ClientDataSet1.fieldbyname('KgQty').Value;
|
||
FieldByName('MQty').Value:=ClientDataSet1.fieldbyname('MQty').Value;
|
||
FieldByName('JH').Value:=ClientDataSet1.fieldbyname('JH').Value;
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
FieldByName('FillerCode').Value:=Trim(DCode);
|
||
Post;
|
||
end;
|
||
if ClientDataSet1.fieldbyname('GangNo').AsString='' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Update_QCRK_GangNo :MYID');
|
||
Parameters.ParamByName('MYID').Value:=Trim(FMainId);
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
if ClientDataSet1.fieldbyname('JH').AsFloat=0 then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update CK_MYSC_CR_MX Set JH=isnull((select isnull(max(JH),0) from CK_MYSC_CR_MX A ');
|
||
sql.Add(' where A.MYID='''+Trim(FMainId)+''' and isnull(A.RCGangNO,'''')=isnull(CK_MYSC_CR_MX.RCGangNO,'''')');
|
||
sql.Add(' and isnull(A.GangNO,'''')=isnull(CK_MYSC_CR_MX.GangNO,'''')),0)+1 ');
|
||
sql.Add(' where MXID='''+Trim(maxmxno)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
Edit;
|
||
FieldByName('MYID').Value:=Trim(FMainId);
|
||
FieldByName('MXID').Value:=Trim(maxmxno);
|
||
Post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
ClientDataSet1.EnableControls;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Update_LLRK_Qty :MYID');
|
||
Parameters.ParamByName('MYID').Value:=Trim(FMainId);
|
||
ExecSQL;
|
||
end;
|
||
//InitData();
|
||
Result:=True;
|
||
except
|
||
Result:=False;
|
||
ClientDataSet1.EnableControls;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(ClientDataSet1,True);
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(ClientDataSet1,False);
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.MYNameBtnClick(Sender: TObject);
|
||
begin
|
||
frmBPZDY_LRPB:=TfrmBPZDY_LRPB.create(self);
|
||
with frmBPZDY_LRPB do
|
||
begin
|
||
flag:='PBName';
|
||
flagName:='<27><><EFBFBD><EFBFBD>';
|
||
ViewFlag:=true;
|
||
Panel4.Align:=alClient;
|
||
ToolBar3.Visible:=false;
|
||
Button1.Visible:=False;
|
||
if ShowModal=1 then
|
||
begin
|
||
MYName.text:=Trim(ClientDataSet1.fieldbyname('BPName').AsString);
|
||
MYCode.text:=Trim(ClientDataSet1.fieldbyname('BPCode').AsString);
|
||
MYPrice.text:=Trim(ClientDataSet1.fieldbyname('BPPrice').AsString);
|
||
Note.text:=Trim(ClientDataSet1.fieldbyname('BPNote').AsString);
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmLLRKInPutMH_PBCK.JCDanWeiBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmGYSList:=TfrmGYSList.Create(Application);
|
||
with frmGYSList do
|
||
begin
|
||
KHType.Text:='Ⱦ<><C8BE>';
|
||
KHType.TxtCode:='Ⱦ<><C8BE>';
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.JCDanWei.Text:=Trim(frmGYSList.Order_Main.fieldbyname('KHName').AsString);
|
||
Self.JCNo.Text:=Trim(frmGYSList.Order_Main.fieldbyname('KHNo').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSList.Free;
|
||
end;
|
||
end;
|
||
|
||
end.
|