D7gmYushang/染整计划(DyeingFinishingPlan.dll)/U_SGRK.pas

1483 lines
38 KiB
ObjectPascal
Raw Permalink Normal View History

2025-09-24 13:13:14 +08:00
unit U_SGRK;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxGridLevel,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
cxControls, cxGridCustomView, cxGrid, RM_Common, RM_Class, RM_GridReport,
RM_System, RM_Dataset, ADODB, DBClient, cxGridCustomPopupMenu, cxGridPopupMenu,
ExtCtrls, ComCtrls, ToolWin, cxTextEdit, Buttons, cxSplitter, cxCheckBox,
MovePanel, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, BtnEdit;
type
TfrmSGRK = class(TForm)
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
cxStyle2: TcxStyle;
cxGridPopupMenu1: TcxGridPopupMenu;
DataSource1: TDataSource;
Order_MJ: TClientDataSet;
ADOQueryMain: TADOQuery;
ADOCmd: TADOQuery;
RMDB_Main: TRMDBDataSet;
RM2: TRMGridReport;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
DataSource2: TDataSource;
CDS_MJCD: TClientDataSet;
DataSource3: TDataSource;
CDS_MJID: TClientDataSet;
Timer1: TTimer;
ADOQueryPrint: TADOQuery;
ScrollBox1: TScrollBox;
SpeedButton13: TSpeedButton;
SpeedButton14: TSpeedButton;
SpeedButton15: TSpeedButton;
SpeedButton16: TSpeedButton;
SpeedButton17: TSpeedButton;
SpeedButton18: TSpeedButton;
SpeedButton22: TSpeedButton;
SpeedButton23: TSpeedButton;
SpeedButton24: TSpeedButton;
SpeedButton25: TSpeedButton;
SpeedButton26: TSpeedButton;
SpeedButton29: TSpeedButton;
SpeedButton31: TSpeedButton;
SpeedButton32: TSpeedButton;
SpeedButton33: TSpeedButton;
SpeedButton34: TSpeedButton;
SpeedButton37: TSpeedButton;
SpeedButton38: TSpeedButton;
SpeedButton40: TSpeedButton;
SpeedButton41: TSpeedButton;
SpeedButton42: TSpeedButton;
cxGridPopupMenu2: TcxGridPopupMenu;
ADOQueryMainDSC: TADOQuery;
SpeedButton45: TSpeedButton;
SpeedButton46: TSpeedButton;
SpeedButton47: TSpeedButton;
SpeedButton50: TSpeedButton;
SpeedButton51: TSpeedButton;
SpeedButton54: TSpeedButton;
SpeedButton55: TSpeedButton;
SpeedButton56: TSpeedButton;
SpeedButton57: TSpeedButton;
SpeedButton59: TSpeedButton;
SpeedButton62: TSpeedButton;
SpeedButton63: TSpeedButton;
SpeedButton64: TSpeedButton;
SpeedButton65: TSpeedButton;
SpeedButton66: TSpeedButton;
SpeedButton70: TSpeedButton;
SpeedButton71: TSpeedButton;
SpeedButton72: TSpeedButton;
SpeedButton73: TSpeedButton;
SpeedButton74: TSpeedButton;
SpeedButton75: TSpeedButton;
Panel2: TPanel;
Label9: TLabel;
MJLen: TEdit;
Label4: TLabel;
MJMaoZ: TEdit;
Label5: TLabel;
Label11: TLabel;
BTPrint: TButton;
Button5: TButton;
Label10: TLabel;
Panel3: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
SpeedButton10: TSpeedButton;
SpeedButton11: TSpeedButton;
SpeedButton12: TSpeedButton;
SpeedButton49: TSpeedButton;
v3Column1: TcxGridDBColumn;
v3Column2: TcxGridDBColumn;
v3Column3: TcxGridDBColumn;
Label26: TLabel;
Edit6: TEdit;
Label30: TLabel;
MJQty3: TEdit;
Label31: TLabel;
Label32: TLabel;
MJQty4: TEdit;
Label33: TLabel;
MovePanel1: TMovePanel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
Label21: TLabel;
Label7: TLabel;
Label8: TLabel;
Edit1: TEdit;
Button1: TButton;
Button4: TButton;
Edit2: TEdit;
CDQty: TEdit;
RadioGroup1: TRadioGroup;
Button2: TButton;
Panel7: TPanel;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
tv2CDType: TcxGridDBColumn;
tv2CDWZ: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
Tv2CDQty: TcxGridDBColumn;
Tv2CDReason: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
Panel8: TPanel;
AOrdDefNote1: TRichEdit;
Label34: TLabel;
ComboBox1: TComboBox;
SpeedButton20: TSpeedButton;
SpeedButton27: TSpeedButton;
SpeedButton28: TSpeedButton;
SpeedButton35: TSpeedButton;
SpeedButton36: TSpeedButton;
SpeedButton43: TSpeedButton;
SpeedButton52: TSpeedButton;
SpeedButton53: TSpeedButton;
SpeedButton60: TSpeedButton;
SpeedButton61: TSpeedButton;
SpeedButton68: TSpeedButton;
SpeedButton69: TSpeedButton;
SpeedButton77: TSpeedButton;
SpeedButton78: TSpeedButton;
SpeedButton79: TSpeedButton;
SpeedButton80: TSpeedButton;
SpeedButton81: TSpeedButton;
SpeedButton82: TSpeedButton;
v3Column4: TcxGridDBColumn;
Label36: TLabel;
MJStr4: TEdit;
Label37: TLabel;
v3Column5: TcxGridDBColumn;
Label38: TLabel;
RM3: TRMGridReport;
mjxh: TEdit;
MKXS: TEdit;
v3Column6: TcxGridDBColumn;
edtYJ: TEdit;
Label2: TLabel;
v2Column4: TcxGridDBColumn;
ADOTmp: TADOQuery;
Label3: TLabel;
Label6: TLabel;
MJFMLen: TEdit;
Label15: TLabel;
YPS: TEdit;
v3Column7: TcxGridDBColumn;
MJType: TComboBox;
SpeedButton19: TSpeedButton;
Label23: TLabel;
C_KZ: TEdit;
Label24: TLabel;
JYKH: TEdit;
CDS_CKCD: TClientDataSet;
DataSource4: TDataSource;
Label25: TLabel;
Label27: TLabel;
C_CODENAME: TEdit;
Label28: TLabel;
Label29: TLabel;
C_Color: TEdit;
C_MF: TEdit;
C_CODE: TBtnEditC;
Label1: TLabel;
LSID: TEdit;
Label39: TLabel;
Edit8: TEdit;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
TBCD: TToolButton;
ToolButton5: TToolButton;
TBClose: TToolButton;
Label12: TLabel;
MJID: TEdit;
Label13: TLabel;
C_KUWEI: TEdit;
Label14: TLabel;
Label16: TLabel;
C_YWY: TBtnEditC;
C_SALESCLASS: TBtnEditC;
Label19: TLabel;
BQGS: TBtnEditC;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure TBCDClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure BTPrintClick(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure SpeedButton13Click(Sender: TObject);
procedure cxGridDBColumn2PropertiesChange(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure SpeedButton49Click(Sender: TObject);
procedure Edit1Click(Sender: TObject);
procedure Edit2Change(Sender: TObject);
procedure Edit6Click(Sender: TObject);
procedure MJstr3KeyPress(Sender: TObject; var Key: Char);
procedure Label9Click(Sender: TObject);
procedure MJQty4Exit(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure MJMaoZChange(Sender: TObject);
procedure APIDClick(Sender: TObject);
procedure MJQty4KeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
procedure Edit8Click(Sender: TObject);
procedure MJLenChange(Sender: TObject);
procedure Tv3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure Button4Click(Sender: TObject);
procedure edtYJClick(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure C_CODEBtnDnClick(Sender: TObject);
procedure C_CODEBtnUpClick(Sender: TObject);
procedure C_YWYBtnDnClick(Sender: TObject);
procedure C_SALESCLASSBtnDnClick(Sender: TObject);
procedure C_YWYBtnUpClick(Sender: TObject);
procedure C_SALESCLASSBtnUpClick(Sender: TObject);
procedure BQGSBtnUpClick(Sender: TObject);
private
{ Private declarations }
FColumn, FAPID, FMainId, FSubId, FFFMJID, FOperationStatus, FYXJL, FJHGZ, FPiHao, FTCNO, Flabname: string;
FCDName: string;
isCommopen, IsJsMessage: boolean;
fxsType, fRollType: string;
procedure InitJP(); //ˢ<>´õ<C2B4>ѡ<EFBFBD><D1A1>
procedure InitCDGrid(); //ˢ<>´õ<C2B4><C3B5><EFBFBD>Ϣ
procedure InitCDGridID(); //ˢ<>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>Ϣ
function CheckData(CKType: string): Boolean; //У<><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function SaveData(): Boolean; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
procedure ClearGlobal(); //<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>ID
procedure PrintCKMDG(MRKOrdID: string); //<2F><>ӡ<EFBFBD><D3A1><EFBFBD>
procedure PrtData(FMJID: string); //<2F><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>ǩ
procedure QuantityConversion(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public
fmanage: string;
fxiugai: string;
{ Public declarations }
end;
var
frmSGRK: TfrmSGRK;
newh, newh1: hwnd;
implementation
uses
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_ProductOrderListSel, U_ZdyMapSel,
U_CPManageSel, U_LabelList;
{$R *.dfm}
procedure TfrmSGRK.QuantityConversion();
var
MLen, MNWet, MGWet, MPWet, MCC, FYJZQty: Double;
begin
MLen := StrToFloatdef(trim(MJLen.Text), 0);
MNWet := StrToFloatdef(trim(MJQty4.Text), 0);
MPWet := StrToFloatdef(trim(MJQty3.Text), 0);
MGWet := StrToFloatdef(trim(MJMaoZ.Text), 0);
MCC := StrToFloatdef(trim(MKXS.Text), 0);
//<2F><><EFBFBD><EFBFBD> <20><> <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD>
if TV2.DataController.Summary.FooterSummaryValues[2] <> NULL then
begin
FYJZQty := StrToFloatdef(TV2.DataController.Summary.FooterSummaryValues[2], 0);
end
else
begin
FYJZQty := 0;
end;
if MCC > 0 then
begin
MGWet := StrToFloat(format('%.1f', [(MLen - FYJZQty) * MCC]));
MNWet := MGWet - MPWet;
MJMaoZ.Text := FloatToStr(MGWet);
MJQty4.Text := FloatToStr(MNWet);
end;
MNWet := MGWet - MPWet;
MJQty4.Text := FloatToStr(MNWet);
end;
function TfrmSGRK.CheckData(CKType: string): Boolean;
var
mvalue: Double;
begin
try
if Trim(C_YWY.Text) = '' then
raise Exception.Create('<27><>ѡ<EFBFBD><D1A1>ҵ<EFBFBD><D2B5>Ա<EFBFBD><D4B1>');
if Trim(C_SALESCLASS.Text) = '' then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if Trim(C_CODE.Text) = '' then
raise Exception.Create('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>');
if Trim(C_Color.Text) = '' then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB>');
if Trim(CKType) = '<27>ύ' then
begin
if trim(Label9.Caption) = '' then
raise Exception.Create('<27><><EFBFBD>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
if trim(MJTYPE.Text) = '' then
raise Exception.Create('<27>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
if trim(YPS.Text) = '' then
raise Exception.Create(<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
if Trim(MJMaoZ.Text) <> '' then
begin
if TryStrToFloat(MJMaoZ.Text, mvalue) = False then
raise Exception.Create('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
if strtofloatdef(trim(MJMaoZ.Text), 0) > 80 then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>80!');
end;
if strtofloatdef(trim(MJQty4.Text), 0) < 0.00 then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>0!');
if strtofloatdef(trim(MJLen.Text), 0) < 0.00 then
raise Exception.Create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>С<EFBFBD><D0A1>0!');
if Trim(MJLen.Text) <> '' then
begin
if strtofloatdef(trim(MJLen.Text), 0) > 400 then
raise Exception.Create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2>ܴ<EFBFBD><DCB4><EFBFBD>400!');
end;
if (strtofloatdef(trim(MJLen.Text), 0) = 0) and (strtofloatdef(trim(MJQty4.Text), 0) = 0) then
raise Exception.Create('<27><><EFBFBD>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>Ϊ0!!');
end;
Result := True;
except
Result := false;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmSGRK.ClearGlobal();
begin
FAPID := '';
FJHGZ := '';
Flabname := '';
FMainId := '';
FSubId := '';
FFFMJID := '';
FTCNO := '';
FPiHao := '';
MJXH.Text := '';
MJstr4.Text := '';
MKXS.Text := '';
AOrdDefNote1.Text := '';
MJQty3.Text := '';
MJQty4.Text := '';
end;
procedure TfrmSGRK.PrintCKMDG(MRKOrdID: string);
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' exec P_Print_RKMDGangNo ');
SQL.Add(' @RKOrdID=''' + Trim(MRKOrdID) + '''');
Open;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(ADOQueryPrint.fieldbyname('RKOrdID').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);
exit;
end;
ExportFtErpFile('<27><EFBFBD><E9B2BC><EFBFBD>ֿ<EFBFBD><D6BF>뵥.rmf', ADOTmp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><EFBFBD><E9B2BC><EFBFBD>ֿ<EFBFBD><D6BF>뵥.rmf';
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
RM2.LoadFromFile(fPrintFile);
Rm2.DefaultCopies := 1;
RM2.ShowReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
Exit;
end;
end;
procedure TfrmSGRK.FormDestroy(Sender: TObject);
begin
frmSGRK := nil;
end;
procedure TfrmSGRK.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfrmSGRK.InitCDGrid();
begin
with ADOQueryMain do
begin
Close;
SQL.Clear;
sql.Add('select * from WFB_MJJY_CD where MJID=' + quotedstr(Trim(FFFMJID)));
Open;
end;
SCreateCDS20(ADOQueryMain, CDS_MJCD);
SInitCDSData20(ADOQueryMain, CDS_MJCD);
end;
procedure TfrmSGRK.InitCDGridID();
var
MMJQty4, MMJLen: double;
begin
with ADOQueryMain do
begin
Close;
SQL.Clear;
sql.Add('select A.*');
sql.Add(',JXXS=(case when MJQty4>0 then round(MJLen/MJQty4,2) else 0 end)');
sql.Add('from WFB_MJJY A where APID=''' + Trim(FAPID) + '''');
Open;
end;
SCreateCDS20(ADOQueryMain, CDS_MJID);
SInitCDSData20(ADOQueryMain, CDS_MJID);
if TV3.DataController.Summary.FooterSummaryValues[1] <> NULL then
MMJLen := TV3.DataController.Summary.FooterSummaryValues[1]
else
MMJLen := 0;
if TV3.DataController.Summary.FooterSummaryValues[3] <> NULL then
MMJQty4 := TV3.DataController.Summary.FooterSummaryValues[3]
else
MMJQty4 := 0;
end;
procedure TfrmSGRK.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmSGRK.TBCDClick(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'WFBCD';
flagname := '<27>õ<EFBFBD>';
fnote := True;
V1Note.Caption := <><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
Self.InitJP();
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmSGRK.FormShow(Sender: TObject);
begin
SInitComBoxBySql(ADOTmp, MJType, False, 'select ZDYName name from KH_Zdy where Type=''MJType'' ');
MJType.ItemIndex := MJType.Items.IndexOf('AA');
InitJP();
InitCDGrid();
end;
procedure TfrmSGRK.InitJP();
var
AA: array[0..100] of string;
i, j: Integer;
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select ZDYName from KH_Zdy where Type=''WFBCD'' order by ZDYNO ');
Open;
end;
if ADOTmp.IsEmpty then
begin
Application.MessageBox(<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>õ㣡', '<27><>ʾ', 0);
Exit;
end;
with ADOTmp do
begin
First;
i := 0;
while not Eof do
begin
AA[i] := Trim(fieldbyname('ZDYName').AsString);
i := i + 1;
Next;
end;
end;
i := i - 1;
if i > 69 then
begin
i := 69;
end;
for j := 0 to i do
begin
with ScrollBox1 do
begin
TSpeedButton(Controls[j]).Visible := True;
TSpeedButton(Controls[j]).Hint := AA[j];
if Length(AA[j]) > 4 then
begin
TSpeedButton(Controls[j]).Caption := Copy(Trim(AA[j]), 1, 4) + #13 + Copy(Trim(AA[j]), 5, Length(AA[j]) - 4);
end
else
TSpeedButton(Controls[j]).Caption := AA[j];
end;
end;
end;
procedure TfrmSGRK.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
if CDS_MJCD.IsEmpty then
Exit;
// if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
// begin
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
CDS_MJCD.Delete;
// end;
end;
function TfrmSGRK.SaveData(): Boolean;
var
maxno, FMJID, BZID, strsql: string;
FMJLen, FYJZQty: Double;
begin
// SCXFlag := '02';
if trim(MJID.Text) <> '' then
begin
FMJID := Trim(MJID.Text);
end
else
begin
FMJID := '';
end;
if fxiugai <> '' then
begin
FMJID := cds_mjid.fieldbyname('mjid').AsString;
end;
try
ADOCmd.Connection.BeginTrans;
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from WFB_MJJY where MJId=''' + Trim(FMJID) + '''');
Open;
end;
with ADOCmd do
begin
if Trim(FMJID) = '' then
begin
Append;
if GetLSNo(ADOTmp, maxno,'SG', 'WFB_MJJY', 4, 1) = False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
exit;
end;
end
else
begin
maxno := Trim(FMJID);
Edit;
end;
if FTCNO <> '' then
begin
FieldByName('MainId').value := Trim(FTCNO);
FieldByName('SubId').value := Trim(FTCNO);
FieldByName('FromMainId').value := Trim(FTCNO);
FieldByName('FromSubId').value := Trim(FTCNO);
end
else
begin
FieldByName('MainId').value := Trim(FMainId);
FieldByName('SubId').value := Trim(FSubId);
FieldByName('FromMainId').value := Trim(FMainId);
FieldByName('FromSubId').value := Trim(FSubId);
end;
FieldByName('APId').value := Trim(FAPID);
FieldByName('PiHao').value := Trim(FPiHao);
FieldByName('MJID').Value := Trim(maxno);
FieldByName('MJStr2').Value := <><CEB4><EFBFBD><EFBFBD>';
FieldByName('MJstr4').Value := Trim(MJstr4.Text); //<2F><><EFBFBD><EFBFBD><EFBFBD>׺<EFBFBD>
FieldByName('mjxh').Value := strtointdef(trim(mjxh.Text), 0);
FieldByName('MJTypeOther').Value := Trim(Label9.Caption);
//<2F><><EFBFBD><EFBFBD> <20><> <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD>
if TV2.DataController.Summary.FooterSummaryValues[2] <> NULL then
begin
FYJZQty := StrToFloatdef(TV2.DataController.Summary.FooterSummaryValues[2], 0);
end
else
begin
FYJZQty := 0;
end;
//<2F><><EFBFBD><EFBFBD>
FieldByName('YPS').Value := StrToFloatDef(YPS.Text, 0);
FieldByName('MJFMLen').Value := StrToFloatDef(MJFMLen.Text, 0);
FieldByName('YJZQty').Value := FYJZQty;
FieldByName('MJLen').Value := StrToFloatdef(trim(MJLen.Text), 0) - FYJZQty - StrToFloatDef(MJFMLen.Text, 0);
//Ƥ<><C6A4>
FieldByName('MJQty3').Value := StrToFloatdef(trim(MJQty3.Text), 0);
//ë<><C3AB>
FieldByName('MJMaoZ').Value := StrToFloatdef(trim(MJMaoZ.Text), 0);
//<2F><><EFBFBD><EFBFBD>
FieldByName('MJQty4').Value := StrToFloatdef(trim(MJMaoZ.Text), 0) - StrToFloatdef(trim(MJQty3.Text), 0);
//ϵ<><CFB5>
FieldByName('MKXS').Value := StrToFloatdef(trim(MKXS.Text), 0);
FieldByName('MJType').Value := Trim(MJType.Text);
FieldByName('JYKH').Value := Trim(JYKH.Text);
FieldByName('JYMF').Value := Trim(C_MF.Text);
FieldByName('JYKZ').Value := Trim(C_KZ.Text);
if Trim(FMJID) = '' then
begin
FieldByName('Filler').Value := Trim(DName);
end
else
begin
FieldByName('Editer').Value := Trim(DName);
FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp);
end;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8>
if Trim(SCXFlag) <> '' then
begin
FieldByName('JTType').Value := Trim(SCXFlag);
end;
FieldByName('MJTypeOther').Value := Trim(Label9.Caption);
Post;
end;
//<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD>޸Ľ<DEB8><C4BD><EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select MJXH from WFB_MJJY');
sql.Add('where MJID=''' + Trim(maxno) + '''');
open;
if not IsEmpty then
begin
MJXH.Text := fieldbyname('mjxh').AsString;
end;
end;
FMJID := Trim(maxno);
FFFMJID := Trim(maxno);
///<2F><><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>
with CDS_MJCD do
begin
First;
while not Eof do
begin
if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
begin
if GetLSNo(ADOTmp, maxno, 'MC', 'WFB_MJJY_CD', 5, 1) = False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
maxno := Trim(CDS_MJCD.fieldbyname('MCID').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from WFB_MJJY_CD ');
sql.Add(' where MCID=''' + Trim(maxno) + '''');
Open;
end;
with ADOCmd do
begin
if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
Append
else
Edit;
FieldByName('MJId').Value := Trim(FMJID);
FieldByName('MCID').Value := Trim(maxno);
SSetSaveDataCDSNew(ADOCmd, Tv2, CDS_MJCD, 'WFB_MJJY_CD', 0);
FieldByName('KouFenType').Value := CDS_MJCD.fieldbyname('KouFenType').Value;
Post;
end;
CDS_MJCD.Edit;
CDS_MJCD.FieldByName('MCID').Value := Trim(maxno);
Next;
end;
end;
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('update WFB_MJJY SET CDList= dbo.F_Get_Order_SubStr(MJID,''MJCDHZSL'')');
sql.Add('where MJID=''' + Trim(FMJID) + ''' ');
execsql;
end;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2BCB0><EFBFBD><EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_CPCK_Insert_CMRK ');
sql.Add('@MJID=' + QuotedStr(Trim(FMJID)));
sql.Add(',@MPRTCodeName=' + QuotedStr(Trim(C_CODENAME.Text)));
sql.Add(',@MPRTCODE=' + QuotedStr(Trim(C_CODE.Text)));
sql.Add(',@PRTCOLOR=' + QuotedStr(Trim(C_Color.Text)));
sql.Add(',@C_MF=' + QuotedStr(Trim(C_MF.Text)));
sql.Add(',@C_KZ=' + QuotedStr(Trim(C_KZ.Text)));
sql.Add(',@C_KUWEI=' + QuotedStr(Trim(C_KUWEI.Text)));
sql.Add(',@C_YWY=' + QuotedStr(Trim(C_YWY.Text)));
sql.Add(',@C_SALESCLASS=' + QuotedStr(Trim(C_SALESCLASS.Text)));
execsql;
end;
ADOCmd.Connection.CommitTrans;
Result := True;
except
Result := False;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
end;
end;
procedure TfrmSGRK.BTPrintClick(Sender: TObject);
var
fPrintFile: string;
mvalue: Double;
i: Integer;
begin
if CheckData('<27>ύ') = False then
exit;
if FJHGZ = '<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>' then
begin
with ADOTmp do
begin
Close;
sql.Clear;
SQL.Add('select * from WFB_MJJY where APID=' + quotedstr(Trim(FAPID)));
SQL.Add(' and mjxh=' + Trim(mjxh.Text));
Open;
end;
if not ADOTmp.IsEmpty then
begin
Application.MessageBox('<27>þ<EFBFBD><C3BE><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4>ڣ<EFBFBD>', '<27><>ʾ', 0);
exit;
end;
end;
if MJID.Text <> '' then
begin
with ADOTmp do
begin
Close;
sql.Clear;
SQL.Add('select * from WFB_MJJY where MJID=' + quotedstr(Trim(MJID.Text)));
Open;
end;
if not ADOTmp.IsEmpty then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4>ڣ<EFBFBD>', '<27><>ʾ', 0);
exit;
end;
end;
if SaveData() then
begin
MJLen.Text := '';
MJFMLen.Text := '';
MJMaoZ.Text := '';
MJQty4.Text := '';
YPS.Text := '';
MJID.Text := '';
edtYJ.Text := '';
MJType.ItemIndex := 1;
MJType.ItemIndex := MJType.Items.IndexOf('AA');
MJXH.Text := inttostr(strTointdef(trim(MJXH.Text), 0) + 1);
if Trim(Edit6.Text) = '<27><>' then
begin
if fxiugai <> '<27>޸<EFBFBD>' then
begin
PrtData(FFFMJID);
end;
end;
end;
FOperationStatus := '';
FFFMJID := '';
fxiugai := '';
InitCDGridID();
InitCDGrid();
if FYXJL = '<27><><EFBFBD><EFBFBD>' then
begin
MJLen.SetFocus;
Edit1Click(MJLen);
end
else
begin
MJMaoZ.SetFocus;
Edit1Click(MJMaoZ);
end;
end;
procedure TfrmSGRK.PrtData(FMJID: string);
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' EXEC P_Print_JYLab ');
SQL.Add(' @MJID=''' + Trim(FMJID) + '''');
Open;
end;
if ADOQueryPrint.IsEmpty then
begin
application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(ADOQueryPrint.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);
exit;
end;
// if FTCNO <> '' then
// begin
// ExportFtErpFile(Trim(Flabname) + '.rmf', ADOTmp);
// fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(Flabname) + '.rmf'
// end
// else
// begin
if Trim(BQGS.Text) <> '' then
begin
ExportFtErpFile(Trim(BQGS.Text) + '.rmf', ADOTmp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(BQGS.Text) + '.rmf'
end
else
begin
ExportFtErpFile(<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf', ADOTmp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ͨ<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf';
end;
// end;
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
RM2.LoadFromFile(fPrintFile);
Rm2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
RM2.PrintReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
end;
procedure TfrmSGRK.SpeedButton1Click(Sender: TObject);
var
fsj: string;
begin
fsj := Trim(TSpeedButton(Sender).Hint);
if Trim(fsj) = '' then
Exit;
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := fsj + Trim(TSpeedButton(Sender).Caption);
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
end;
procedure TfrmSGRK.SpeedButton12Click(Sender: TObject);
var
fsj: string;
begin
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
if Trim(fsj) = '' then
Exit;
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := Copy(fsj, 1, Length(fsj) - 1);
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
end;
procedure TfrmSGRK.SpeedButton13Click(Sender: TObject);
var
i: Integer;
begin
if CheckData('<27>õ<EFBFBD>') = False then
exit;
FCDName := Trim(TSpeedButton(Sender).Hint);
MovePanel1.Visible := True;
Label21.Caption := Trim(FCDName);
//<2F><>ʾ<EFBFBD><CABE><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD>
Edit1.SetFocus;
Panel3.Visible := True;
with Panel3 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TSpeedButton then
begin
TSpeedButton(Controls[i]).Hint := Trim(Edit1.Name);
end;
end;
end;
end;
procedure TfrmSGRK.cxGridDBColumn2PropertiesChange(Sender: TObject);
var
fsj: string;
begin
fsj := Trim(Order_MJ.fieldbyname('SubId').AsString);
Order_MJ.DisableControls;
with Order_MJ do
begin
First;
while not Eof do
begin
if Trim(Order_MJ.fieldbyname('SubId').AsString) <> fsj then
begin
Edit;
FieldByName('SSel').Value := False;
end;
Next;
end;
end;
Order_MJ.EnableControls;
Order_MJ.Locate('SubId', fsj, []);
end;
procedure TfrmSGRK.Button1Click(Sender: TObject);
var
mvalue: Double;
begin
{ if Trim(Edit1.Text)='' then
begin
Application.MessageBox(<>ò<EFBFBD><C3B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
exit;
end; }
if Trim(Edit1.Text) <> '' then
begin
if Trim(Edit2.Text) <> '' then
begin
if StrToFloat(Edit2.Text) < StrToFloat(Edit1.Text) then
begin
Application.MessageBox('<27>õ<EFBFBD>λ<EFBFBD><CEBB>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
end;
if CDQty.Text <> '' then
begin
if TryStrToFloat(CDQty.Text, mvalue) = False then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
with CDS_MJCD do
begin
Append;
FieldByName('cdname').Value := Trim(FCDName);
FieldByName('CDbeg').Value := Trim(Edit1.Text);
FieldByName('CDEnd').Value := Trim(Edit2.Text);
FieldByName('KouFenQty').Value := 0;
if RadioGroup1.ItemIndex > -1 then
FieldByName('KouFenType').Value := RadioGroup1.Items.Strings[RadioGroup1.ItemIndex];
if RadioGroup1.ItemIndex > -1 then
begin
if RadioGroup1.ItemIndex < 3 then
begin
FieldByName('KouFenQty').Value := RadioGroup1.ItemIndex + 1;
end
else
begin
FieldByName('KouFenQty').Value := 4;
end;
end;
if Trim(FCDName) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
FieldByName('KouFenQty').Value := 0;
FieldByName('CDQty').Value := StrToFloatdef(trim(CDQty.Text), 0);
if Trim(edtYJ.Text) <> '' then
begin
FieldByName('YJQty').Value := StrToFloatdef(trim(CDQty.Text), 0);
end
else
begin
FieldByName('YJQty').Value := 0;
end;
Post;
end;
Edit1.Text := '';
Edit2.Text := '';
CDQty.Text := '';
MovePanel1.Visible := False;
Panel3.Visible := False;
end;
procedure TfrmSGRK.ToolButton1Click(Sender: TObject);
begin
InitJP();
end;
procedure TfrmSGRK.Button5Click(Sender: TObject);
var
fPrintFile: string;
i: Integer;
mvalue: Double;
begin
if CDS_MJID.IsEmpty then
Exit;
PrtData(CDS_MJID.fieldbyname('MJID').AsString);
end;
procedure TfrmSGRK.SpeedButton49Click(Sender: TObject);
begin
Panel3.Visible := False;
end;
procedure TfrmSGRK.Edit1Click(Sender: TObject);
var
i: Integer;
begin
Panel3.Visible := True;
with Panel3 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TSpeedButton then
begin
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
end;
end;
end;
end;
procedure TfrmSGRK.Edit2Change(Sender: TObject);
var
mvalue: Double;
begin
if Trim(Edit1.Text) <> '' then
begin
if TryStrToFloat(Edit1.Text, mvalue) = False then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
Exit;
end;
if Trim(Edit2.Text) <> '' then
begin
if TryStrToFloat(Edit2.Text, mvalue) = False then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
Exit;
end;
CDQty.Text := FloatToStr(StrToFloat(Edit2.Text) - StrToFloat(Edit1.Text));
end;
procedure TfrmSGRK.Edit6Click(Sender: TObject);
begin
if Trim(Edit6.Text) = '' then
begin
Edit6.Text := '<27><>';
end
else
begin
Edit6.Text := '';
end;
end;
procedure TfrmSGRK.MJstr3KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
end;
procedure TfrmSGRK.Label9Click(Sender: TObject);
begin
if trim(Label9.Caption) = 'M' then
begin
Label9.Caption := 'Y';
Label3.Caption := 'Y';
Label20.Caption := 'Y';
Label7.Caption := 'Y';
end
else
begin
Label9.Caption := 'M';
Label3.Caption := 'M';
Label20.Caption := 'M';
Label7.Caption := 'M';
end;
end;
procedure TfrmSGRK.MJQty4Exit(Sender: TObject);
begin
if (trim(MJMaoZ.Text) = '') and (trim(MJQty4.Text) = '') then
exit;
if (trim(MJMaoZ.Text) = '') and (trim(MJQty3.Text) = '') then
exit;
if (trim(MJQty4.Text) = '') and (trim(MJQty3.Text) = '') then
exit;
if (trim(MJQty3.Text) = '') then
exit;
if (trim(MJQty4.Text) <> '') then
begin
MJMaoZ.Text := floattostr(strtofloatdef(trim(MJQty3.Text), 0) + strtofloatdef(trim(MJQty4.Text), 0));
exit;
end;
end;
procedure TfrmSGRK.Button2Click(Sender: TObject);
begin
RadioGroup1.ItemIndex := -1;
end;
procedure TfrmSGRK.MJMaoZChange(Sender: TObject);
begin
QuantityConversion();
end;
procedure TfrmSGRK.APIDClick(Sender: TObject);
var
i: Integer;
begin
Panel3.Visible := True;
with Panel3 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TSpeedButton then
begin
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
end;
end;
end;
end;
procedure TfrmSGRK.MJQty4KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
BTPrint.Click;
end;
end;
procedure TfrmSGRK.FormCreate(Sender: TObject);
begin
IsCommopen := false;
IsJsMessage := false;
end;
procedure TfrmSGRK.Edit8Click(Sender: TObject);
begin
if Trim(Edit8.Text) = '' then
begin
Edit8.Text := '<27><>';
Button5.Visible := true;
end
else
begin
Edit8.Text := '';
Button5.Visible := false;
end;
end;
procedure TfrmSGRK.MJLenChange(Sender: TObject);
begin
QuantityConversion();
end;
procedure TfrmSGRK.Tv3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
FMJLen, FMJMaoZ: Double;
begin
FMJLen := AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('MJLen').Index];
FMJMaoZ := AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('MJMaoZ').Index];
if (FMJLen < 10) or (FMJLen > 200) then
begin
ACanvas.Brush.Color := $B5E4FF;
end;
if (FMJMaoZ < 5) or (FMJMaoZ > 40) then
begin
ACanvas.Brush.Color := $B5E4FF;
end
end;
procedure TfrmSGRK.Button4Click(Sender: TObject);
begin
MovePanel1.Visible := false;
end;
procedure TfrmSGRK.edtYJClick(Sender: TObject);
begin
if Trim(TEdit(Sender).Text) = '' then
begin
TEdit(Sender).Text := '<27><>';
end
else
begin
TEdit(Sender).Text := '';
end;
end;
procedure TfrmSGRK.ToolButton5Click(Sender: TObject);
var
FSCRZ: string;
begin
if CDS_MJID.IsEmpty then
exit;
with ADOTmp do
begin
Close;
sql.Clear;
SQL.Add('select * from FHSQ_SUB A WHERE A.MJID=' + QuotedStr(trim(CDS_MJID.fieldbyName('MJID').AsString)));
OPEN;
end;
if ADOTmp.IsEmpty = False then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>ֹɾ<D6B9><C9BE><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
exit;
end;
if Application.MessageBox(PChar(<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>š<EFBFBD>' + trim(CDS_MJID.fieldbyName('MJXH').AsString) + '<27><>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'), '', 32 + 4) <> IDYES then
Exit;
FSCRZ := '';
FSCRZ := '<27><><EFBFBD><EFBFBD><EFBFBD>룺' + trim(CDS_MJID.fieldbyname('MJID').AsString);
FSCRZ := FSCRZ + ' <20><><EFBFBD>ţ<EFBFBD>' + trim(CDS_MJID.fieldbyname('MJXH').AsString);
FSCRZ := FSCRZ + ' <20><><EFBFBD>ţ<EFBFBD>' + trim(CDS_MJID.fieldbyname('apid').AsString);
FSCRZ := FSCRZ + ' ë<>أ<EFBFBD>' + trim(CDS_MJID.fieldbyname('MJMaoZ').AsString);
FSCRZ := FSCRZ + ' <20><><EFBFBD>أ<EFBFBD>' + trim(CDS_MJID.fieldbyname('MJQty4').AsString);
FSCRZ := FSCRZ + ' <20><><EFBFBD>ȣ<EFBFBD>' + trim(CDS_MJID.fieldbyname('MJLen').AsString);
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('delete WFB_MJJY where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + '''');
sql.Add('delete CK_BanCP_CR where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + '''');
sql.Add('delete CK_BanCP_KC where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + '''');
sql.Add('delete WFB_MJJY_CD where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').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><CFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
sql.Add(',' + quotedstr(FSCRZ));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(')');
ExecSQL;
end;
InitCDGrid();
InitCDGridid();
end;
procedure TfrmSGRK.C_CODEBtnDnClick(Sender: TObject);
begin
TBtnEditC(Sender).Text := '';
TBtnEditC(Sender).TxtCode := '';
end;
procedure TfrmSGRK.C_CODEBtnUpClick(Sender: TObject);
begin
if GetLSNo(ADOTmp, FAPID, 'GM', 'WFB_MJJY', 4, 1) = False then
begin
// ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
exit;
end;
frmCPManageSel := TfrmCPManageSel.Create(self);
with frmCPManageSel do
begin
if showmodal = 1 then
begin
mjxh.Text := '1';
LSID.Text := Trim(FAPID);
C_CODE.Text := CDS_Main.fieldbyname('CYNo').asstring;
C_CODENAME.Text := CDS_Main.fieldbyname('CYName').asstring;
C_MF.Text := CDS_Main.fieldbyname('CYyxmf').asstring;
C_KZ.Text := CDS_Main.fieldbyname('CYkz').asstring;
end;
free;
end;
end;
procedure TfrmSGRK.C_YWYBtnDnClick(Sender: TObject);
begin
C_YWY.Text := '';
end;
procedure TfrmSGRK.C_SALESCLASSBtnDnClick(Sender: TObject);
begin
C_SALESCLASS.TEXT := '';
end;
procedure TfrmSGRK.C_YWYBtnUpClick(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'Salesman';
flagname := <><D2B5>Ա';
if ShowModal = 1 then
begin
C_YWY.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmSGRK.C_SALESCLASSBtnUpClick(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'SalesClass';
flagname := <><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
C_SALESCLASS.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmSGRK.BQGSBtnUpClick(Sender: TObject);
begin
try
frmLabelList := TfrmLabelList.Create(Application);
with frmLabelList do
begin
if ShowModal = 1 then
begin
BQGS.Text := Trim(ADOQueryLabel.fieldbyname('labelCaption').AsString);
end;
end;
finally
frmLabelList.Free;
end;
end;
end.