D7DJenchuang/检验管理/U_MJManageNewFDNew.pas
DESKTOP-E401PHE\Administrator 6716567ef8 ~
2025-04-28 17:09:12 +08:00

3191 lines
91 KiB
ObjectPascal
Raw Permalink 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_MJManageNewFDNew;
interface
uses
Windows, Messages, SysUtils, Variants, math, 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, ShellAPI;
type
TfrmMJManageNewFDNewSF = class(TForm)
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
cxStyle2: TcxStyle;
cxGridPopupMenu1: TcxGridPopupMenu;
DataSource1: TDataSource;
Order_MJ: TClientDataSet;
ADOQueryMain: TADOQuery;
ADOCmd: TADOQuery;
ADOTmp: 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;
cxStyleRepository2: TcxStyleRepository;
cxStyle3: TcxStyle;
cxStyleRepository3: TcxStyleRepository;
cxStyle4: TcxStyle;
cxStyleRepository4: TcxStyleRepository;
cxStyle5: TcxStyle;
cxStyleRepository5: TcxStyleRepository;
cxStyle6: TcxStyle;
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;
MJFK: TEdit;
Label3: TLabel;
MJLen: TEdit;
Label4: TLabel;
MJMaoZ: TEdit;
Label5: TLabel;
Label6: TLabel;
Label11: TLabel;
BTPrint: TButton;
Edit3: TEdit;
Label10: TLabel;
Edit4: TEdit;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
MJQty1: TEdit;
Label15: TLabel;
Label22: TLabel;
Label23: TLabel;
MJSJKZ: TEdit;
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;
Label27: TLabel;
MJQty2: TEdit;
Label26: TLabel;
Edit6: TEdit;
Label29: TLabel;
MJstr3: TEdit;
Label30: TLabel;
MJQty3: TEdit;
Label31: TLabel;
Label32: TLabel;
MJQty4: TEdit;
Label33: TLabel;
MovePanel1: TMovePanel;
Label17: TLabel;
Label18: TLabel;
Label19: 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;
MJXH: TEdit;
v3Column5: TcxGridDBColumn;
kmxs: TEdit;
Label39: TLabel;
MJstr5: TEdit;
Label40: TLabel;
Label41: TLabel;
Edit8: TEdit;
Label42: TLabel;
v2Column4: TcxGridDBColumn;
baoNo: TEdit;
Label45: TLabel;
BaoID: TEdit;
Button7: TButton;
v3Column6: TcxGridDBColumn;
ToolBar1: TToolBar;
Panel9: TPanel;
Label49: TLabel;
Label50: TLabel;
MaxRollNo: TEdit;
MinRollNo: TEdit;
TBCD: TToolButton;
ToolButton3: TToolButton;
ToolButton2: TToolButton;
ToolButton4: TToolButton;
TBClose: TToolButton;
Label1: TLabel;
APID: TEdit;
Button6: TButton;
Panel6: TPanel;
Label2: TLabel;
Label16: TLabel;
Label24: TLabel;
Label25: TLabel;
Label35: TLabel;
Label38: TLabel;
Label44: TLabel;
Label46: TLabel;
Label47: TLabel;
Label48: TLabel;
Label51: TLabel;
Label52: TLabel;
BTAdd: TButton;
BTEdit: TButton;
Button3: TButton;
Edit7: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Edit12: TEdit;
ComboBox2: TComboBox;
Tv3Column1: TcxGridDBColumn;
Button5: TButton;
Label28: TLabel;
Banno: TEdit;
banid: TEdit;
Tv3Column2: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure MJMaoZClick(Sender: TObject);
procedure MJLenClick(Sender: TObject);
procedure MJFKClick(Sender: TObject);
procedure MJBanZuClick(Sender: TObject);
procedure MJSJKZClick(Sender: TObject);
procedure Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure FormClick(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure BTAddClick(Sender: TObject);
procedure BTEditClick(Sender: TObject);
procedure BTPrintClick(Sender: TObject);
procedure Tv2CDQtyPropertiesEditValueChanged(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure SpeedButton13Click(Sender: TObject);
procedure cxGridDBColumn2PropertiesChange(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure SpeedButton49Click(Sender: TObject);
procedure APIDKeyPress(Sender: TObject; var Key: Char);
procedure Edit1Click(Sender: TObject);
procedure Edit2Change(Sender: TObject);
procedure Edit3Click(Sender: TObject);
procedure Edit4Click(Sender: TObject);
procedure Edit6Click(Sender: TObject);
procedure MJstr3KeyPress(Sender: TObject; var Key: Char);
procedure Label9Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure MJQty4Change(Sender: TObject);
procedure MJMaoZChange(Sender: TObject);
procedure APIDClick(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Edit7Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure MJQty4KeyPress(Sender: TObject; var Key: Char);
procedure MJXHClick(Sender: TObject);
procedure MJLenChange(Sender: TObject);
procedure MJQty3Change(Sender: TObject);
procedure MJQty2Change(Sender: TObject);
procedure MJQty4KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure MJStr4Exit(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure Edit9Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Edit10Click(Sender: TObject);
procedure Edit11Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure MaxRollNoKeyPress(Sender: TObject; var Key: Char);
procedure Edit12Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure TBCDClick(Sender: TObject);
procedure baoNoExit(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure BannoChange(Sender: TObject);
procedure BannoExit(Sender: TObject);
private
{ Private declarations }
FInt, PState, PrintInt, SCInitGrid, FState, FCK: Integer;
FColumn, FBanZu, FAPID, FMainId, FSubId, FFFMJID: string;
FJZ, FJC, FDC: Double;
fRollType, fRollType1, fbaotype, fbaosx, fOrderUnit: string;
isCommopen, IsJsMessage: boolean;
MValue, FCDName, MggCDFalg: string;
fxsws, fxsws1: string;
procedure InitJP();
procedure InitCDGrid();
procedure InitCDGridID();
procedure PrtBaoData(FBaoid: string); //<2F><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>ǩ
procedure AddCD(Fbtn: TButton);
procedure AddSL(Fbtn: TButton);
function SaveData(): Boolean;
procedure BtnStatus(BSInt: Boolean);
procedure AddSLNew(Fbtn: TSpeedButton);
procedure AddCDNew(Fbtn: TSpeedButton);
procedure SavedataCK();
procedure PrtData(FMJID: string);
procedure OpenCom(DllName: string);
procedure CloseCom(DllName: string);
procedure On1201(var Message: Tmessage); message 1201;
procedure On1301(var Message: Tmessage); message 1301;
function JsXj(str1: string): string;
public
fmanage: string;
{ Public declarations }
end;
var
frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF;
newh, newh1: hwnd;
implementation
uses
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_ClothHCList, MMSystem,
U_SysLogOrder;
{$R *.dfm}
procedure TfrmMJManageNewFDNewSF.On1301(var Message: Tmessage);
var
i1, i2: integer;
unitname: string;
fdata, i: double;
begin
i1 := Message.WParam;
i2 := Message.LParam;
if IsJsMessage then
begin
if (trim(Edit7.Text) = '<27><>') then
begin
if trim(fxsws) = '-1' then
MJLen.Text := format('%.0f', [i1 / 100000 - 0.5])
else
MJLen.Text := format('%.' + trim(fxsws) + 'f', [i1 / 100000]);
if i2 = 0 then
Label9.Caption := 'M'
else
begin
Label9.Caption := 'Y';
i := strtofloat(format('%.' + trim(fxsws) + 'f', [i1 / 100000]));
if Trim(SCXFlag) = '6' then
begin
MJLen.Text := format('%.' + trim(fxsws) + 'f', [i]);
end
else
begin
MJLen.Text := format('%.' + trim(fxsws) + 'f', [i / 0.9144]);
end;
end;
if trim(fxsws) = '-1' then
edit1.Text := format('%.0f', [i1 / 100000 - 0.5])
else
edit1.Text := format('%.' + trim(fxsws) + 'f', [i1 / 100000]);
end;
end;
end;
procedure TfrmMJManageNewFDNewSF.On1201(var Message: Tmessage);
var
i1, i2: integer;
unitname: string;
fdata: double;
begin
i1 := Message.WParam;
i2 := Message.LParam;
if IsJsMessage then
begin
if trim(Edit9.Text) = '<27><>' then
begin
MJMaoZ.Text := format('%.' + trim(fxsws1) + 'f', [i1 / 100000]);
end;
end;
end;
procedure TfrmMJManageNewFDNewSF.CloseCom(DllName: string);
type
TMyFunc = function(sCommName: PAnsiChar): HWND; stdcall;
var
Tf1: TMyFunc;
Tp1: TFarProc;
Th1: Thandle;
begin
Th1 := LoadLibrary(Pchar(trim(DllName)));
if Th1 > 0 then
begin
try
Tp1 := GetProcAddress(Th1, 'CommClose');
if Tp1 <> nil then
begin
Tf1 := TMyFunc(Tp1);
newh1 := Tf1('Comm1');
end
else
begin
end;
finally
// FreeLibrary(Th1);
end;
end
else
begin
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
end;
end;
procedure TfrmMJManageNewFDNewSF.OpenCom(DllName: string);
type
TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): HWND; stdcall;
var
Tf: TMyFunc;
Tp: TFarProc;
Th: Thandle;
begin
// closeCom(FComFile);
Th := LoadLibrary(Pchar(trim(DllName)));
if Th > 0 then
begin
try
Tp := GetProcAddress(Th, 'CommOpen');
if Tp <> nil then
begin
Tf := TMyFunc(Tp);
newh := Tf(self.Handle, 'Comm1', 500, 1);
if newh < 1 then
begin
application.MessageBox(Pchar('<27>򿪴<EFBFBD><F2BFAAB4><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>'), '<27><>ʾ');
end
else
IsCommOpen := true;
end
else
begin
IsCommOpen := false;
end;
finally
// FreeLibrary(Th);
end;
end
else
begin
IsCommOpen := false;
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
end;
end;
function TfrmMJManageNewFDNewSF.JsXj(str1: string): string;
begin
end;
procedure TfrmMJManageNewFDNewSF.FormDestroy(Sender: TObject);
begin
frmMJManageNewFDNewSF := nil;
end;
procedure TfrmMJManageNewFDNewSF.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
if isCommopen then
begin
if trim(DllName) <> '' then
closeCom(DllName);
if trim(JCYDLL) <> '' then
closeCom(JCYDLL);
end;
end;
procedure TfrmMJManageNewFDNewSF.InitCDGrid();
begin
with ADOQueryMain do
begin
Close;
SQL.Clear;
if PState = 1 then
sql.Add('select * from WFB_MJJY_CD where MJID='''' ')
else
sql.Add('select * from WFB_MJJY_CD where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + '''');
Open;
end;
SCreateCDS20(ADOQueryMain, CDS_MJCD);
SInitCDSData20(ADOQueryMain, CDS_MJCD);
end;
procedure TfrmMJManageNewFDNewSF.InitCDGridID();
begin
with ADOQueryMain do
begin
Close;
SQL.Clear;
sql.Add('select ');
//sql.Add('Case when isnull(MJType,'''')=''<27><>Ʒ'' then ''B''+RTrim(Cast(MJXH as varchar(20))) else Cast(MJXH as varchar(20)) end as MJXH ,');
// sql.Add(' A.* from WFB_MJJY A where APID=''' + Trim(FAPID) + '''');
sql.Add(' A.*,B.Prtcolor from WFB_MJJY A inner join JYOrder_sub B on B.subId=A.subId where A.mainID=''' + Trim(FmainID) + '''');
if Trim(SCXFlag) <> '' then
sql.Add(' and JTType=''' + Trim(SCXFlag) + '''');
sql.Add('and mjstr2='<><CEB4><EFBFBD><EFBFBD>'' ');
SQL.Add('and banno=''' + Trim(Banno.text) + '''');
sql.Add(' order by FillTime desc');
Open;
end;
SCreateCDS20(ADOQueryMain, CDS_MJID);
SInitCDSData20(ADOQueryMain, CDS_MJID);
end;
procedure TfrmMJManageNewFDNewSF.TBCloseClick(Sender: TObject);
begin
WriteCxGrid('<27><>Ʒ<EFBFBD><C6B7>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>Tv2', Tv2);
WriteCxGrid('<27><>Ʒ<EFBFBD><C6B7>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>Tv3', Tv3);
close;
end;
procedure TfrmMJManageNewFDNewSF.FormShow(Sender: TObject);
begin
readCxGrid('<27><>Ʒ<EFBFBD><C6B7>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>Tv2', Tv2);
readCxGrid('<27><>Ʒ<EFBFBD><C6B7>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>Tv3', Tv3);
InitJP();
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select BanZu from SY_User where UserId=''' + Trim(DCode) + '''');
Open;
FBanZu := Trim(Fieldbyname('BanZu').AsString);
end;
if trim(Edit7.Text) = '<27><>' then
IsJsMessage := true;
if trim(fmanage) <> '<27><>Ȩ<EFBFBD><C8A8>' then
begin
if trim(DllName) <> '' then
OpenCom(DllName);
if trim(JCYDLL) <> '' then
OpenCom(JCYDLL);
Edit7.Visible := true;
Label35.Visible := true;
Edit9.Visible := true;
Label44.Visible := true;
end;
end;
procedure TfrmMJManageNewFDNewSF.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 ');
// showmessage(sql.text);
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 > 59 then
begin
i := 59;
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 TfrmMJManageNewFDNewSF.AddCD(Fbtn: TButton);
begin
if PState < 1 then
Exit;
if Order_MJ.IsEmpty then
Exit;
with CDS_MJCD do
begin
Append;
FieldByName('cdname').Value := Trim(TButton(Fbtn).Caption);
Post;
end;
end;
procedure TfrmMJManageNewFDNewSF.AddCDNew(Fbtn: TSpeedButton);
begin
with CDS_MJCD do
begin
Append;
FieldByName('cdname').Value := Trim(TSpeedButton(Fbtn).Hint);
Post;
end;
end;
procedure TfrmMJManageNewFDNewSF.AddSL(Fbtn: TButton);
begin
if PState < 1 then
Exit;
if Order_MJ.IsEmpty then
Exit;
//if MJMaoZ.Focused then
if FInt = 4 then
Exit;
if CDS_MJCD.IsEmpty = False then
begin
FColumn := Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName;
if Trim(FColumn) <> '' then
begin
with CDS_MJCD do
begin
Edit;
FieldByName(FColumn).Value := Trim(FieldByName(FColumn).AsString) + Trim(TButton(Fbtn).Caption);
if Trim(fieldbyname('CDQtyS').AsString) <> '' then
Fieldbyname('CDQty').Value := Trim(fieldbyname('CDQtyS').AsString);
Post;
end;
end;
end;
end;
procedure TfrmMJManageNewFDNewSF.AddSLNew(Fbtn: TSpeedButton);
begin
if PState < 1 then
Exit;
if Trim(FAPID) = '' then
Exit;
if FInt = 4 then
Exit;
if FInt = 11 then
begin
if TSpeedButton(Fbtn).Tag = 9 then
Exit;
Edit1.Text := Trim(Edit1.Text) + Trim(TSpeedButton(Fbtn).Caption);
Edit1.SelectAll;
end
else if FInt = 12 then
begin
if TSpeedButton(Fbtn).Tag = 9 then
Exit;
Edit2.Text := Trim(Edit2.Text) + Trim(TSpeedButton(Fbtn).Caption);
Edit2.SelectAll;
end;
end;
procedure TfrmMJManageNewFDNewSF.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;
procedure TfrmMJManageNewFDNewSF.MJMaoZClick(Sender: TObject);
begin
FInt := 1;
FColumn := '';
panel3.Visible := True;
end;
procedure TfrmMJManageNewFDNewSF.MJLenClick(Sender: TObject);
begin
FInt := 2;
FColumn := '';
panel3.Visible := True;
end;
procedure TfrmMJManageNewFDNewSF.MJFKClick(Sender: TObject);
begin
FInt := 3;
FColumn := '';
panel3.Visible := True;
end;
procedure TfrmMJManageNewFDNewSF.MJBanZuClick(Sender: TObject);
begin
FInt := 4;
end;
procedure TfrmMJManageNewFDNewSF.MJSJKZClick(Sender: TObject);
begin
FInt := 4;
end;
procedure TfrmMJManageNewFDNewSF.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
//DataLink_WFBProducttion.ADOLink.Connected:=False;
FInt := 4;
// if PState=1 then Exit;
InitCDGridID();
//InitCDGrid();
{with ADOTmp do
begin
close;
sql.Clear;
sql.Add('select * from WFB_MJJY where MJID='''+Trim(CDS_MJID.fieldbyname('MJID').AsString)+'''');
Open;
end;
if ADOTmp.IsEmpty then
begin
MJMaoZ.Text:='';
MJLen.Text:='';
MJFK.Text:='';
MJSJKZ.Text:='';
end else
SSetWinData(ADOTmp,Panel5); }
end;
procedure TfrmMJManageNewFDNewSF.FormClick(Sender: TObject);
begin
FInt := 4;
end;
procedure TfrmMJManageNewFDNewSF.Button12Click(Sender: TObject);
var
fsj: string;
begin
if PState < 1 then
Exit;
if Trim(FAPID) = '' then
Exit;
if FInt = 4 then
Exit;
begin
FColumn := Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName;
if Trim(FColumn) <> '' then
begin
if Trim(CDS_MJCD.FieldByName(FColumn).AsString) <> '' then
begin
with CDS_MJCD do
begin
Edit;
if Length(CDS_MJCD.FieldByName(FColumn).AsString) = 1 then
begin
FieldByName(FColumn).Value := null;
FieldByName('CDQty').Value := 0;
end
else
begin
FieldByName(FColumn).Value := Copy(Trim(FieldByName(FColumn).AsString), 1, Length(Trim(FieldByName(FColumn).AsString)) - 1);
FieldByName('CDQty').Value := FieldByName(FColumn).Value;
end;
Post;
end;
end;
end;
end;
end;
function TfrmMJManageNewFDNewSF.SaveData(): Boolean;
var
maxno, FMJID, BZID, strsql, CFMJXH, GMJXH, GMJLen, GMJMaoZ, GMJQty4, Gmjstr4, Banflag: string;
FMJLen, i: Double;
FOrder: Integer;
begin
result := false;
if PState = 1 then
FMJID := ''
else if PState = 2 then
FMJID := Trim(CDS_MJID.fieldbyname('MJID').AsString)
else if PState < 1 then
Exit;
if PState = 1 then
begin
if ComboBox2.ItemIndex = 0 then
begin
if fRollType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
sql.Add('from WFB_MJJY X where X.mainID=''' + trim(fmainId) + ''' ');
Open;
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
end;
end
else if fRollType = '<27><><EFBFBD>׺<EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
sql.Add('from WFB_MJJY X where X.subID=''' + trim(FSubId) + ''' ');
sql.add('and X.MJStr4=' + quotedstr(trim(MJstr4.text)));
Open;
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
end;
end
else if fRollType = '<27>޹<EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
end
else
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
sql.Add('from WFB_MJJY X where X.subID=''' + trim(FSubId) + ''' ');
Open;
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
end;
end;
end;
end;
if minRollNo.Text <> '' then
begin
if StrToIntDef(minRollNo.Text, 0) > StrToIntDef(MJXH.Text, 0) then
begin
Application.MessageBox('С<><D0A1><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡', '<27><>ʾ', 0);
exit;
end;
end;
if MaxRollNo.Text <> '' then
begin
if StrToIntDef(MaxRollNo.Text, 0) < StrToIntDef(MJXH.Text, 0) then
begin
Application.MessageBox('<27>ѳ<EFBFBD><D1B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡', '<27><>ʾ', 0);
exit;
end;
end;
try
ADOCmd.Connection.BeginTrans;
if PState = 2 then
begin
GMJXH := Trim(CDS_MJID.fieldbyname('MJXH').AsString);
GMJLen := Trim(CDS_MJID.fieldbyname('MJLen').AsString);
GMJMaoZ := Trim(CDS_MJID.fieldbyname('MJMaoZ').AsString);
GMJQty4 := Trim(CDS_MJID.fieldbyname('MJQty4').AsString);
Gmjstr4 := Trim(CDS_MJID.fieldbyname('mjstr4').AsString);
GMJXH := '<27><><EFBFBD>ţ<EFBFBD>' + GMJXH + ',<2C>׺ţ<D7BA>' + Gmjstr4 + ',<2C><><EFBFBD>ȣ<EFBFBD>' + GMJLen + ',' + <>أ<EFBFBD>' + GMJMaoZ + ',<2C><><EFBFBD>أ<EFBFBD>' + GMJQty4;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result,Mainid) values( ');
sql.Add(' ' + quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(trim('<27>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>')));
sql.Add(',' + quotedstr(trim('<27>޸<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + trim(FMJID) + ', ' + trim(Label24.Caption) + ', ' + trim(Label38.Caption) + ', ' + trim(Label25.Caption) + ', ' + trim(GMJXH))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(',' + quotedstr(trim(FMainId)));
sql.Add(')');
execsql;
end;
end;
Banflag := '0';
///<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, Trim(SCXFlag), '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;
FieldByName('MainId').value := Trim(FMainId);
FieldByName('SubId').value := Trim(FSubId);
FieldByName('APId').value := Trim(FAPId);
FieldByName('MJID').Value := Trim(maxno);
FieldByName('MJStr2').Value := <><CEB4><EFBFBD><EFBFBD>';
FieldByName('MJBanZu').Value := Trim(FBanZu);
FieldByName('MJstr3').Value := Trim(MJstr3.Text);
FieldByName('MJstr4').Value := Trim(MJstr4.Text);
FieldByName('MJstr5').Value := Trim(MJstr5.Text);
FieldByName('mjxh').Value := Trim(mjxh.Text);
FieldByName('MJTypeOther').Value := Trim(Label9.Caption);
FieldByName('MJStr1').Value := Trim(Label13.Caption);
FieldByName('Banno').Value := Trim(Banno.text);
FieldByName('Banid').Value := Trim(banid.text);
FieldByName('Banflag').Value := Banflag;
if Edit12.Text <> '' then
begin
FieldByName('DingMaFlag').Value := '<27><><EFBFBD><EFBFBD>';
end;
if Edit10.Text <> '' then
begin
FieldByName('DaoXuFlag').Value := '<27><><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD>';
end;
FieldByName('QuhaoFlag').Value := Trim(ComboBox2.Text);
if (FDC <> 0) and (Edit12.text <> '') then
begin
FieldByName('MJLen').Value := FDC;
end
else
begin
if trim(fOrderUnit) <> 'KG' then
FieldByName('MJLen').Value := StrToFloatdef(trim(MJLen.Text), 0) - StrToFloatdef(trim(MJQty2.Text), 0) + fjc
else
FieldByName('MJLen').Value := StrToFloatdef(trim(MJLen.Text), 0) + fjc;
end;
FieldByName('MJQty1').Value := StrToFloatdef(trim(MJQty1.Text), 0);
FieldByName('MJQty2').Value := StrToFloatdef(trim(MJQty2.Text), 0);
FieldByName('MJQty3').Value := StrToFloatdef(trim(MJQty3.Text), 0);
if trim(fOrderUnit) = 'KG' then
begin
FieldByName('MJQty4').Value := StrToFloatdef(trim(MJQty4.Text), 0) - StrToFloatdef(trim(MJQty2.Text), 0) + fjZ;
FieldByName('MJMaoZ').Value := StrToFloatdef(trim(MJMaoZ.Text), 0) - StrToFloatdef(trim(MJQty2.Text), 0) + fjZ;
end
else
begin
FieldByName('MJQty4').Value := StrToFloatdef(trim(MJQty4.Text), 0) + fjZ;
FieldByName('MJMaoZ').Value := StrToFloatdef(trim(MJMaoZ.Text), 0) + fjZ;
end;
if Trim(MJFK.Text) <> '' then
begin
FieldByName('MJFK').Value := MJFK.Text;
end;
if Trim(MJSJKZ.Text) <> '' then
begin
FieldByName('MJSJKZ').Value := MJSJKZ.Text;
end;
FieldByName('MJType').Value := '';
if Trim(Edit3.Text) <> '' then
begin
FieldByName('MJType').Value := '<27><>Ʒ';
end;
if Trim(Edit4.Text) <> '' then
begin
FieldByName('MJType').Value := '<27><>Ʒ';
end;
FieldByName('MJStr1').Value := Trim(Label13.Caption);
if Trim(FMJID) = '' then
begin
FieldByName('Filler').Value := Trim(DName);
end
else
begin
FieldByName('Editer').Value := Trim(DName);
FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp);
end;
if Trim(SCXFlag) <> '' then
begin
FieldByName('JTType').Value := Trim(SCXFlag);
end;
FieldByName('MJTypeOther').Value := Trim(Label9.Caption);
if trim(fbaotype) = '<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>' then
begin
FieldByName('baoNO').Value := Trim(baono.text);
FieldByName('baoID').Value := Trim(baoID.Text);
end;
Post;
end;
if banno.text <> '' then
begin
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('update WFB_MJJY SET banid= ''' + banid.text + '''');
sql.Add('where MainID=''' + Trim(FMainID) + ''' and banno=''' + Trim(banno.text) + ''' and JTType=''' + Trim(SCXFlag) + '''');
// showmessage(sql.text);
execsql;
end;
end;
if PState = 1 then
begin
if ComboBox2.ItemIndex = 0 then
begin
if fRollType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('update WFB_MJJY SET mjxh=1+isnull((select cast (max(mjxh) as int) from WFB_MJJY X where X.mainID=WFB_MJJY.mainID and X.MJID<>WFB_MJJY.MJID),0)');
sql.Add('where MJID=''' + Trim(maxno) + '''');
execsql;
end;
end
else if fRollType = '<27><><EFBFBD>׺<EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('update WFB_MJJY SET mjxh=1+isnull((select cast (max(mjxh) as int) from WFB_MJJY X ');
sql.Add(' where X.subID=WFB_MJJY.subID and isnull(X.mjstr4,'''')=isnull(WFB_MJJY.mjstr4,'''') and X.MJID<>WFB_MJJY.MJID),0)');
sql.Add('where MJID=''' + Trim(maxno) + '''');
execsql;
end;
end
else if fRollType = '<27>޹<EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
end
else
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('update WFB_MJJY SET mjxh=1+isnull((select cast (max(mjxh) as int) from WFB_MJJY X where X.subID=WFB_MJJY.subID and X.MJID<>WFB_MJJY.MJID),0)');
sql.Add('where MJID=''' + Trim(maxno) + '''');
execsql;
end;
end;
end;
end
else if PState = 2 then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFB_MJJY where MJID=''' + Trim(maxno) + '''');
Open;
end;
GMJXH := Trim(ADOCmd.fieldbyname('MJXH').AsString);
GMJLen := Trim(ADOCmd.fieldbyname('MJLen').AsString);
GMJMaoZ := Trim(ADOCmd.fieldbyname('MJMaoZ').AsString);
GMJQty4 := Trim(ADOCmd.fieldbyname('MJQty4').AsString);
Gmjstr4 := Trim(ADOCmd.fieldbyname('mjstr4').AsString);
GMJXH := '<27><><EFBFBD>ţ<EFBFBD>' + GMJXH + ',<2C>׺ţ<D7BA>' + Gmjstr4 + ',<2C><><EFBFBD>ȣ<EFBFBD>' + GMJLen + ',' + <>أ<EFBFBD>' + GMJMaoZ + ',<2C><><EFBFBD>أ<EFBFBD>' + GMJQty4;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result,Mainid) values( ');
sql.Add(' ' + quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(trim('<27>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>')));
sql.Add(',' + quotedstr(trim('<27>޸ĺ<DEB8><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + trim(maxno) + ', ' + trim(Label24.Caption) + ', ' + trim(Label38.Caption) + ', ' + trim(Label25.Caption) + ', ' + trim(GMJXH))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(',' + quotedstr(trim(FMainId)));
sql.Add(')');
execsql;
end;
end;
////////////<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ź;<C5BA><CDBE><EFBFBD><EFBFBD>ظ<EFBFBD>
if fRollType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select Top 1 MJXH,MJID from WFB_MJJY A where A.mainID=''' + Trim(FMainId) + ''' order by MJXH Desc');
Open;
end;
GMJXH := Trim(ADOCmd.fieldbyname('MJXH').AsString);
GMJLen := Trim(ADOCmd.fieldbyname('MJID').AsString);
GMJMaoZ := IntToStr(StrToInt(GMJXH) - 1);
if Trim(GMJXH) <> '1' then
begin
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select MJID from WFB_MJJY X where X.mainID=''' + Trim(FMainId) + '''');
SQL.Add(' and MJXH=' + GMJXH + '-1');
Open;
end;
if ComboBox2.ItemIndex = 0 then
begin
if ADOCmd.IsEmpty then
begin
Result := False;
ADOCmd.Connection.RollbackTrans;
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ!', '<27><>ʾ', 0);
Exit;
end;
end
else if ComboBox2.ItemIndex = 1 then
begin
if ADOCmd.IsEmpty then
begin
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
if Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 32 + 4) <> IDYes then
begin
Result := False;
ADOCmd.Connection.RollbackTrans;
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result,Mainid) 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><EFBFBD>')));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + trim(GMJLen) + ', ' + '<27><><EFBFBD>ţ<EFBFBD>' + Trim(GMJXH) + ', ' + trim(Label24.Caption) + ', ' + trim(Label38.Caption) + ', ' + trim(Label25.Caption) + ',<2C><><EFBFBD>ţ<EFBFBD>' + Trim(GMJMaoZ))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(',' + quotedstr(trim(FMainId)));
sql.Add(')');
execsql;
end;
end;
end;
end;
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>ж<EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select Mainid,MJXH from WFB_MJJY X where X.mainID=''' + Trim(FMainId) + '''');
sql.Add(' Group by Mainid,MJXH having count(*)>1');
Open;
end;
if ADOCmd.IsEmpty = False then
begin
CFMJXH := Trim(ADOCmd.fieldbyname('MJXH').AsString);
Result := False;
ADOCmd.Connection.RollbackTrans;
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
Application.MessageBox(Pchar('<27><><EFBFBD><EFBFBD>: ' + Trim(CFMJXH) + ' <20>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EBB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!'), '<27><>ʾ', 0);
Exit;
end;
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>ж<EFBFBD>
end
else if fRollType = '<27><><EFBFBD>׺<EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
begin
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select Top 1 MJXH,MJID from WFB_MJJY A ');
sql.Add(' where A.mainID=''' + Trim(FMainId) + ''' and isnull(A.MJStr4,'''')=''' + Trim(MJStr4.Text) + '''');
sql.Add(' order by MJXH Desc');
Open;
end;
GMJXH := Trim(ADOCmd.fieldbyname('MJXH').AsString);
GMJLen := Trim(ADOCmd.fieldbyname('MJID').AsString);
GMJMaoZ := IntToStr(StrToInt(GMJXH) - 1);
if Trim(GMJXH) <> '1' then
begin
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select MJID from WFB_MJJY X where X.mainID=''' + Trim(FMainId) + ''' and isnull(X.MJStr4,'''')=''' + Trim(MJStr4.Text) + '''');
SQL.Add(' and MJXH=' + GMJXH + '-1');
Open;
end;
if ComboBox2.ItemIndex = 0 then
begin
if ADOCmd.IsEmpty then
begin
Result := False;
ADOCmd.Connection.RollbackTrans;
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ!', '<27><>ʾ', 0);
Exit;
end;
end
else if ComboBox2.ItemIndex = 1 then
begin
if ADOCmd.IsEmpty then
begin
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
if Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 32 + 4) <> IDYes then
begin
Result := False;
ADOCmd.Connection.RollbackTrans;
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result,Mainid) 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><EFBFBD>')));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + trim(GMJLen) + ', ' + '<27><><EFBFBD>ţ<EFBFBD>' + Trim(GMJXH) + ', ' + trim(Label24.Caption) + ', ' + trim(Label38.Caption) + ', ' + trim(Label25.Caption) + ',<2C><><EFBFBD>ţ<EFBFBD>' + Trim(GMJMaoZ))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(',' + quotedstr(trim(FMainId)));
sql.Add(')');
execsql;
end;
end;
end;
end;
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>ж<EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select subid,MJStr4,MJXH from WFB_MJJY X where X.mainID=''' + Trim(FMainId) + ''' and isnull(X.MJStr4,'''')=''' + Trim(MJStr4.Text) + '''');
sql.Add(' Group by subid,MJStr4,MJXH having count(*)>1');
Open;
end;
if ADOCmd.IsEmpty = False then
begin
CFMJXH := Trim(ADOCmd.fieldbyname('MJXH').AsString);
Result := False;
ADOCmd.Connection.RollbackTrans;
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
Application.MessageBox(Pchar('<27><><EFBFBD><EFBFBD>: ' + Trim(CFMJXH) + ' <20>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EBB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!'), '<27><>ʾ', 0);
Exit;
end;
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>ж<EFBFBD>
end
else if fRollType = '<27>޹<EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
end
else
begin
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select Top 1 MJXH,MJID from WFB_MJJY A where A.Subid=''' + Trim(FSubid) + ''' order by MJXH Desc');
Open;
end;
GMJXH := Trim(ADOCmd.fieldbyname('MJXH').AsString);
GMJLen := Trim(ADOCmd.fieldbyname('MJID').AsString);
GMJMaoZ := IntToStr(StrToInt(GMJXH) - 1);
if Trim(GMJXH) <> '1' then
begin
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select MJID from WFB_MJJY X where X.Subid=''' + Trim(FSubid) + '''');
SQL.Add(' and MJXH=' + GMJXH + '-1');
Open;
end;
if ComboBox2.ItemIndex = 0 then
begin
if ADOCmd.IsEmpty then
begin
Result := False;
ADOCmd.Connection.RollbackTrans;
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ!', '<27><>ʾ', 0);
Exit;
end;
end
else if ComboBox2.ItemIndex = 1 then
begin
if ADOCmd.IsEmpty then
begin
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
if Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 32 + 4) <> IDYes then
begin
Result := False;
ADOCmd.Connection.RollbackTrans;
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result,Mainid) 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><EFBFBD>')));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + trim(GMJLen) + ', ' + '<27><><EFBFBD>ţ<EFBFBD>' + Trim(GMJXH) + ', ' + trim(Label24.Caption) + ', ' + trim(Label38.Caption) + ', ' + trim(Label25.Caption) + ',<2C><><EFBFBD>ţ<EFBFBD>' + Trim(GMJMaoZ))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(',' + quotedstr(trim(FMainId)));
sql.Add(')');
execsql;
end;
end;
end;
end;
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>ж<EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select SubID,MJXH from WFB_MJJY X where X.SubID=''' + Trim(FSubID) + '''');
sql.Add(' Group by SubID,MJXH having count(*)>1');
Open;
end;
if ADOCmd.IsEmpty = False then
begin
CFMJXH := Trim(ADOCmd.fieldbyname('MJXH').AsString);
Result := False;
ADOCmd.Connection.RollbackTrans;
PlaySound('wav\<5C><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
Application.MessageBox(Pchar('<27><><EFBFBD><EFBFBD>: ' + Trim(CFMJXH) + ' <20>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EBB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!'), '<27><>ʾ', 0);
Exit;
end;
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>ж<EFBFBD>
end;
////////////<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ź;<C5BA><CDBE><EFBFBD><EFBFBD>ظ<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 CDS_MJID do
begin
Append;
FieldByName('MJID').Value := Trim(FMJID);
Post;
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;
if (fbaotype = '<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>') or (fbaotype = '') or (PState = 2) then
begin
end
else
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Update_Bao ''' + trim(FMJID) + ''' ');
if fbaotype = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
sql.Add(',1 ');
end
else if fbaotype = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ' then
begin
sql.Add(',2 ');
end
else if fbaotype = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ' then
begin
sql.Add(',3 ');
end;
execsql;
end;
end;
ADOCmd.Connection.CommitTrans;
Result := True;
except
Result := False;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
end;
end;
procedure TfrmMJManageNewFDNewSF.BTAddClick(Sender: TObject);
begin
if Trim(Label24.Caption) = '' then
Exit;
PState := 1;
InitCDGridID();
InitCDGrid();
BtnStatus(True);
Label16.Caption := '<27><><EFBFBD><EFBFBD>';
end;
procedure TfrmMJManageNewFDNewSF.BTEditClick(Sender: TObject);
begin
if CDS_MJID.IsEmpty then
Exit;
PState := 2;
Label16.Caption := '<27>޸<EFBFBD>';
end;
procedure TfrmMJManageNewFDNewSF.BTPrintClick(Sender: TObject);
var
fPrintFile: string;
mvalue: Double;
mvalue1: integer;
i: Integer;
begin
if Trim(FAPID) = '' then
Exit;
if (strtofloatdef(trim(MJLen.Text), 0) = 0) and (strtofloatdef(trim(mjqty4.Text), 0) = 0) then
begin
application.MessageBox('<27><><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>Ϊ<EFBFBD>㣡', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
exit;
end;
if trim(MJXH.text) = '' then
begin
application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>', '<27><>ʾ');
exit;
end;
if trim(MJXH.text) = '0' then
begin
application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ0', '<27><>ʾ');
exit;
end;
if trim(Label9.Caption) = '' then
begin
Application.MessageBox('<27><><EFBFBD>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(MJQty1.Text) <> '' then
begin
if TryStrToFloat(MJQty1.Text, mvalue) = False then
begin
Application.MessageBox(<><D4AD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
if Trim(MJMaoZ.Text) <> '' then
begin
if TryStrToFloat(MJMaoZ.Text, mvalue) = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
if Trim(MJQty2.Text) <> '' then
begin
if TryStrToFloat(MJQty2.Text, mvalue) = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
if (strtofloatdef(trim(MJLen.Text), 0) > 200) then
begin
application.MessageBox('<27><><EFBFBD>Ȳ<EFBFBD><C8B2>ܴ<EFBFBD><DCB4><EFBFBD>200<30><30>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
exit;
end;
if Trim(Edit6.Text) <> '' then
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from JYorder_Sub where Subid=''' + Trim(FSubId) + ''' and isnull(Slbname,'''')<>'''' ');
Open;
end;
if ADOTmp.IsEmpty then
begin
PlaySound('wav\û<><C3BB><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD>ǩ.wav', 0, SND_FILENAME or SND_ASYNC);
Application.MessageBox(<><C3BB><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD>ǩ', '<27><>ʾ', 0);
Exit;
end
else
begin
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOTmp.fieldbyname('Slbname').AsString);
if FileExists(fPrintFile) then
begin
end
else
begin
PlaySound('wav\<5C><>ǩû<C7A9><C3BB><EFBFBD>ҵ<EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
Application.MessageBox('<27><>ǩû<C7A9><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EBB3A2><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>п<EFBFBD><D0BF>ܱ<EFBFBD>ǩû<C7A9><C3BB><EFBFBD>ϴ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
end;
end;
BTPrint.Enabled := False;
Button5.Enabled := False;
Timer1.Enabled := True;
if SaveData() then
begin
MJMaoZ.Text := '';
MJQty1.Text := '';
MJQty2.Text := '';
Label15.Caption := '';
MJQty4.Text := '';
if edit10.Text = '<27><>' then
begin
MJXH.Text := inttostr(strTointdef(trim(MJXH.Text), 0) - 1);
end
else
begin
MJXH.Text := inttostr(strTointdef(trim(MJXH.Text), 0) + 1);
end;
if PState = 1 then
begin
PlaySound('wav\<5C><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
end
else if PState = 2 then
begin
PlaySound('wav\<5C>޸ijɹ<C4B3>.wav', 0, SND_FILENAME or SND_ASYNC);
end;
if PState = 2 then
begin
apid.Text := FAPID;
Button3.Click;
end;
end
else
exit;
if Trim(Edit6.Text) = '<27><>' then
begin
PrtData(FFFMJID);
end;
if Trim(Edit6.Text) = '<27><>' then
begin
if (fbaotype = '<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>') or (fbaotype = '') then
begin
end
else
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_View_Baoid ''' + trim(FFFMJID) + ''' ');
sql.Add(',''' + trim(FMainId) + ''' ,''' + trim(FSubId) + ''' ');
if fbaotype = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
sql.Add(' ,1 ');
end;
if fbaotype = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ' then
begin
sql.Add(' ,2 ');
end;
if fbaotype = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ' then
begin
sql.Add(' ,3 ');
end;
Open;
end;
if ADOCmd.FieldByName('baoid').AsString <> '' then
begin
baoNo.Text := inttostr(ADOCmd.fieldbyname('baoNo').AsInteger + 1);
PrtBaoData(ADOCmd.fieldbyname('baoid').AsString);
end;
end;
end;
Label16.Caption := '';
BTAdd.Click;
MJLen.SetFocus;
MJQty4.OnClick(MJQty4);
end;
procedure TfrmMJManageNewFDNewSF.PrtBaoData(FBaoid: string);
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
i: Integer;
begin
if CDS_MJID.IsEmpty then
exit;
CDS_MJID.First;
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add('select A.Baoid,A.BaoNo,A.MJTypeOther as QtyUnit,D.OrderNo,D.conNo,D.customerNoName,D.MprtCodeName,D.Mprtspec,D.OrdPerson1,D.MPRTKuanNO,D.LBName,D.NLBName,');
sql.Add('PRTCodeName=DBO.F_Get_Order_SubStr(BaoID,''BNCodeName''),');
sql.Add('PRTColor=DBO.F_Get_Order_SubStr(BaoID,''BNColor''),SOrddefstr1=DBO.F_Get_Order_SubStr(BaoID,''BNSOrddefstr1''),');
sql.Add('SOrddefstr4=DBO.F_Get_Order_SubStr(BaoID,''BNSOrddefstr4''),PRtHX=DBO.F_Get_Order_SubStr(BaoID,''BNPRtHX''), ');
sql.Add('Mjstr4=DBO.F_Get_Order_SubStr(BaoID,''BNGangNo''), ');
sql.Add('MJXH=DBO.F_Get_Order_SubStr(BaoID,''BNMJXH''), ');
sql.Add('BNMJLENLIST=DBO.F_Get_Order_SubStr(BaoID,''BNMJLENLIST''), ');
sql.Add('PRTkuanNo=DBO.F_Get_Order_SubStr(BaoID,''BNPrtkuanno''),');
sql.Add('khConNo=(select top 1 khConNo from JYOrderCon_Main X where X.ConNO=D.conNO), ');
sql.Add('MprtCodeNameEng=(select top 1 Note from KH_Zdy X where X.zdyName=D.MprtCodeName), ');
SQL.ADD('count(A.MJID) as JSl,sum(A.MJMaoZ) MJMAOZ,sum(MJQty2) as MJQty2,sum(MJQty3) as MJQty3,sum(MJQty4) as MJQty4,SUM(A.MJLen)as MJLen');
sql.Add('from WFB_MJJY A');
sql.Add('inner join JYOrder_Sub C on C.SubID=A.SubID');
sql.Add('inner join JYOrder_Main D on D.MainID=A.MainID');
SQL.Add('where A.BaoID=''' + Trim(FBaoid) + '''');
SQL.ADD('group by A.Baoid,A.BaoNo,A.MJTypeOther,D.OrderNo,D.conNo,D.customerNoName,D.MprtCodeName,D.Mprtspec,D.OrdPerson1,D.MPRTKuanNO,D.LBName,D.NLBName');
Open;
end;
if ADOQueryPrint.RecordCount > 1 then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if ADOQueryPrint.RecordCount < 1 then
begin
Application.MessageBox('<27>˰<EFBFBD><CBB0>Ż<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3>ڴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>룡', '<27><>ʾ', 0);
Exit;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := trim(FBaoid);
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 Trim(ADOQueryPrint.fieldbyname('NLBName').AsString) <> '' then
begin
ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('NLbName').AsString), ADOCmd);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('NLbName').AsString)
end
else
begin
ExportFtErpFile('<27><><EFBFBD><EFBFBD>ǩ.rmf', ADOCmd);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ǩ.rmf';
end;
if not FileExists(fPrintFile) then
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
Exit;
end;
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
RM2.LoadFromFile(fPrintFile);
RM2.DefaultCopies := 1;
//RM2.ShowReport;
RM2.printReport;
end;
end;
procedure TfrmMJManageNewFDNewSF.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('select A.MJID,A.mjstr3,QtyUnit=A.MJTypeOther,B.orderNo,B.conNo,B.customerNoName,B.LBName ');
sql.Add(',EngColor=(select max(Note) from KH_Zdy X where X.ZDYName=C.PRTColor and X.Type=''OrdColor'' ) ');
sql.Add(',B.MPRTCF,C.*,A.* ');
sql.Add(' from WFB_MJJY A');
sql.Add(' inner join JYOrder_Main B On A.Mainid=B.Mainid');
sql.Add(' inner join JYOrder_Sub C on A.SubId=C.SubId');
SQL.Add(' where A.MJID=''' + Trim(FMJID) + '''');
Open;
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);
CDS_MJID.EnableControls;
exit;
end;
if Trim(ADOQueryPrint.fieldbyname('Slbname').AsString) <> '' then
begin
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('Slbname').AsString);
ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('Slbname').AsString), ADOCmd);
end
else
begin
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ͨ<>ñ<EFBFBD>ǩ.rmf';
ExportFtErpFile(<>ñ<EFBFBD>ǩ.rmf', ADOCmd);
end;
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
RM2.LoadFromFile(fPrintFile);
RM2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
// RM2.ShowReport;
Sleep(1000);
RM2.PrintReport;
if MggCDFalg = '99' then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result,MainId) values( ');
sql.Add(' ' + quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>')));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + trim(CDS_MJID.FieldByName('MJID').AsString) + ',' + trim(Label24.Caption) + ',' + trim(Label38.Caption) + ',' + trim(Label25.Caption) + ',<2C>׺ţ<D7BA>' + trim(CDS_MJID.FieldByName('mjstr4').AsString) + ',<2C><><EFBFBD><EFBFBD>:' + trim(CDS_MJID.FieldByName('MJXH').AsString) + ',<2C><><EFBFBD><EFBFBD>:' + trim(ComboBox1.Text))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(',' + quotedstr(trim(FMainId)));
sql.Add(')');
execsql;
end;
PlaySound('wav\<5C>ش<EFBFBD><D8B4>ɹ<EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
end;
MggCDFalg := '';
end
else
begin
MggCDFalg := '';
PlaySound('wav\<5C><>ǩû<C7A9><C3BB><EFBFBD>ҵ<EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
Application.MessageBox('<27><>ǩû<C7A9><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EBB3A2><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>п<EFBFBD><D0BF>ܱ<EFBFBD>ǩû<C7A9><C3BB><EFBFBD>ϴ<EFBFBD>', '<27><>ʾ', 0);
end;
end;
procedure TfrmMJManageNewFDNewSF.SavedataCK();
var
CRID: Integer;
MaxCkNo, MaxCkSubNo: string;
begin
//if Trim(Cds_Main.fieldbyname('SubType').AsString)='<27><><EFBFBD><EFBFBD>' then
//////////////////////////////////////////////////////////////<2F><><EFBFBD><EFBFBD><E6B5BD><EFBFBD><EFBFBD>Ʒ<EFBFBD>ֿ<EFBFBD>////////////////////////////////////////////////
with ADOCmd do
begin
Close;
sql.Clear;
SQL.add('Update CK_BanCP_CRID Set CRID=CRID+1');
sql.Add('select * from CK_BanCP_CRID');
Open;
end;
CRID := ADOCmd.fieldbyname('CRID').Value;
if GetLSNo(ADOCmd, MaxCkNo, 'JR', 'CK_BanCP_CR', 4, 1) = False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>Ʒ<EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from CK_BanCP_CR where 1<>1');
Open;
end;
with ADOCmd do
begin
Append;
FieldByName('MainId').Value := Trim(FMainId);
FieldByName('SubId').Value := Trim(FSubId);
FieldByName('APID').Value := Trim(FAPID);
FieldByName('MJID').Value := Trim(CDS_MJID.fieldbyname('MJId').AsString);
FieldByName('BCID').Value := Trim(MaxCkNo);
FieldByName('CRTime').Value := SGetServerDateTime(ADOTmp);
FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD>';
FieldByName('CRType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
//FieldByName('JTType').Value:=Trim(XJFlag);
FieldByName('CRID').Value := CRID;
if Trim(MJMaoZ.Text) <> '' then
begin
FieldByName('KGQty').Value := StrToFloat(MJMaoZ.Text);
end;
if Trim(MJLen.Text) <> '' then
begin
FieldByName('Qty').Value := StrToFloat(MJLen.Text);
end;
FieldByName('QtyUnit').Value := Trim(Label9.Caption);
FieldByName('Filler').Value := Trim(DName);
FieldByName('FillTime').Value := SGetServerDateTime(ADOTmp);
if Trim(Edit3.Text) <> '' then
begin
FieldByName('CPType').Value := '<27><>Ʒ';
end;
if Trim(Edit4.Text) <> '' then
begin
FieldByName('CPType').Value := '<27><>Ʒ';
end;
Post;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from CK_BanCP_KC where 1<>1');
Open;
end;
with ADOCmd do
begin
Append;
FieldByName('CRID').Value := CRID;
FieldByName('BCID').Value := Trim(MaxCkNo);
FieldByName('MJID').Value := Trim(CDS_MJID.fieldbyname('MJID').AsString);
if Trim(MJMaoZ.Text) <> '' then
begin
FieldByName('KCKGQty').Value := StrToFloat(MJMaoZ.Text);
end;
if Trim(MJLen.Text) <> '' then
begin
FieldByName('KCQty').Value := StrToFloat(MJLen.Text);
end;
FieldByName('KCQtyUnit').Value := Trim(Label9.Caption);
Post;
end;
end;
procedure TfrmMJManageNewFDNewSF.BtnStatus(BSInt: Boolean);
begin
// Tv2.OptionsSelection.CellSelect:=BSInt;
end;
procedure TfrmMJManageNewFDNewSF.Tv2CDQtyPropertiesEditValueChanged(Sender: TObject);
var
mvalue: string;
begin
try
mvalue := TcxTextEdit(Sender).EditingText;
if Trim(mvalue) <> '' then
begin
CDS_MJCD.Edit;
CDS_MJCD.FieldByName('CDQty').Value := mvalue;
CDS_MJCD.Post;
end
else
begin
CDS_MJCD.Edit;
CDS_MJCD.FieldByName('CDQty').Value := 0;
CDS_MJCD.Post;
end;
CDS_MJCD.Edit;
CDS_MJCD.FieldByName('CDQtyS').Value := mvalue;
except
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>֣<EFBFBD>', '<27><>ʾ', 0);
end;
end;
procedure TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.SpeedButton13Click(Sender: TObject);
var
i: Integer;
begin
if Trim(Label24.Caption) = '' then
Exit;
if Label24.Visible = False then
Exit;
{with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from Order_JYResult where APID='''+Trim(FAPID)+'''');
Open;
end;
if ADOTmp.IsEmpty then
begin
Application.MessageBox('<27>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD>δ¼<CEB4><C2BC>,<2C><><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD>!','<27><>ʾ',0);
Exit;
end; }
if Trim(CDS_MJCD.fieldbyname('MJID').AsString) <> '' then
begin
BTAdd.Click;
end;
if Trim(Label15.Caption) <> '' then
begin
//MJFK.Text:='';
//MJSJKZ.Text:='';
MJLen.Text := '';
MJMaoZ.Text := '';
MJQty1.Text := '';
//MJSJKZ.Text:='';
Label15.Caption := '';
end;
if Trim(FAPID) = '' then
Exit;
FCDName := Trim(TSpeedButton(Sender).Hint);
MovePanel1.Visible := True;
Label21.Caption := Trim(FCDName);
FInt := 11;
Edit1.SetFocus;
//CDQty.SetFocus;
Panel3.Visible := True;
PState := 1;
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 TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.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 := RadioGroup1.ItemIndex + 1;
FieldByName('JBQty').Value := strtofloatdef(trim(Edit8.Text), 0);
if Trim(CDQty.Text) <> '' then
begin
FieldByName('CDQty').Value := StrToFloat(CDQty.Text);
end
else
begin
FieldByName('CDQty').Value := 0;
end;
Post;
end;
Edit1.Text := '';
Edit2.Text := '';
CDQty.Text := '';
Edit8.Text := '';
MovePanel1.Visible := False;
Panel3.Visible := False;
end;
procedure TfrmMJManageNewFDNewSF.Button4Click(Sender: TObject);
begin
Edit1.Text := '';
Edit2.Text := '';
CDQty.Text := '';
MovePanel1.Visible := False;
Panel3.Visible := False;
end;
procedure TfrmMJManageNewFDNewSF.SpeedButton49Click(Sender: TObject);
begin
Panel3.Visible := False;
end;
procedure TfrmMJManageNewFDNewSF.APIDKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Button3.Click;
end;
end;
procedure TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.Edit3Click(Sender: TObject);
begin
if Trim(Edit3.Text) = '' then
begin
Edit3.Text := '<27><>';
Edit4.Text := '';
end
else
begin
Edit3.Text := '';
end;
end;
procedure TfrmMJManageNewFDNewSF.Edit4Click(Sender: TObject);
begin
if Trim(Edit4.Text) = '' then
begin
Edit4.Text := '<27><>';
Edit3.Text := '';
end
else
begin
Edit4.Text := '';
end;
end;
procedure TfrmMJManageNewFDNewSF.Edit6Click(Sender: TObject);
begin
if Trim(Edit6.Text) = '' then
begin
Edit6.Text := '<27><>';
end
else
begin
Edit6.Text := '';
end;
end;
procedure TfrmMJManageNewFDNewSF.MJstr3KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
BTPrint.Click;
end;
end;
procedure TfrmMJManageNewFDNewSF.Label9Click(Sender: TObject);
begin
if trim(Label9.Caption) = 'M' then
begin
Label9.Caption := 'Y';
Label19.Caption := 'Y';
Label20.Caption := 'Y';
Label7.Caption := 'Y';
end
else
begin
Label9.Caption := 'M';
Label19.Caption := 'M';
Label20.Caption := 'M';
Label7.Caption := 'M';
end;
end;
procedure TfrmMJManageNewFDNewSF.Button2Click(Sender: TObject);
begin
RadioGroup1.ItemIndex := -1;
end;
procedure TfrmMJManageNewFDNewSF.MJQty4Change(Sender: TObject);
var
FReal: Double;
begin
if Trim(MJQty4.Text) = '' then
begin
MJMaoZ.Text := '';
Exit;
end;
if TryStrToFloat(MJQty4.Text, FReal) = False then
Exit;
if Edit11.Text = '' then
begin
if (strtofloatdef(trim(kmxs.Text), 0) <> 0) and (strtofloatdef(trim(mjQty4.Text), 0) <> 0) then
begin
MJLen.Text := format('%.' + trim(fxsws) + 'f', [(strtofloatdef(trim(mjQty4.Text), 0) + fjZ) * strtofloatdef(trim(kmxs.Text), 0)])
end;
end;
end;
procedure TfrmMJManageNewFDNewSF.MJMaoZChange(Sender: TObject);
var
FReal, jz: Double;
begin
if Trim(MJMaoZ.Text) = '' then
begin
MJQty4.Text := '';
Exit;
end;
if TryStrToFloat(MJMaoZ.Text, FReal) = False then
Exit;
if Trim(MJQty3.Text) <> '' then
begin
if TryStrToFloat(MJQty3.Text, FReal) = False then
Exit;
jz := StrToFloat(MJMaoZ.Text) - StrToFloat(MJQty3.Text);
MJQty4.Text := format('%.' + trim(fxsws1) + 'f', [jz]);
end
else
begin
MJQty4.Text := MJMaoZ.Text;
end;
if Edit11.Text <> '' then
begin
if (strtofloatdef(trim(kmxs.Text), 0) <> 0) and (strtofloatdef(trim(MJMaoZ.Text), 0) <> 0) then
begin
MJLen.Text := format('%.' + trim(fxsws) + 'f', [(strtofloatdef(trim(MJMaoZ.Text), 0) + fjZ) * strtofloatdef(trim(kmxs.Text), 0)])
end;
end;
end;
procedure TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.Button3Click(Sender: TObject);
var
FBaoID, FBanid: string;
begin
fRollType := '';
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select B.*,B.OrderNo OrderNoM,C.*, ');
// select maxbanno=(select top 1 BanNO from WFB_MJJY where banflag='1' by desc )
SQL.Add('maxbanno=1+isnull((select max(banno) from WFB_MJJY X where X.subid=C.subid and banflag=1),0),');
sql.Add('maxMJxh=isnull((select max(mjxh) from WFB_MJJY X where X.SubID=C.subID),0),');
sql.Add('minMJxh=isnull((select min(mjxh) from WFB_MJJY X where X.SubID=C.subID),1),');
sql.Add('maxBaoNO=case when B.baosx=''<27><><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>'' then 1+isnull((select max(cast(baoNO as int)) from WFB_MJJY X where X.mainID=C.mainID and X.subid=C.subID ),0)');
sql.Add(' else 1+isnull((select max(cast(baoNO as int)) from WFB_MJJY X where X.mainID=C.mainID ),0) end ');
sql.Add('from JYOrder_Sub C');
SQL.Add('inner join JYOrder_Main B on B.MainId=C.MainId ');
sql.Add('where C.SubID=''' + Trim(APID.Text) + '''');
// showmessage(sql.text);
Open;
end;
if ADOTmp.IsEmpty = False then
begin
if edit10.Text = '<27><>' then
begin
fRollType := '<27>޹<EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
fRollType1 := trim(ADOTmp.fieldbyname('Orddefstr15').AsString);
end
else
begin
fRollType := trim(ADOTmp.fieldbyname('Orddefstr15').AsString);
end;
Label24.Visible := True;
Label24.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + Trim(ADOTmp.fieldbyname('OrderNoM').AsString);
Label38.Visible := True;
Label38.Caption := 'Ʒ<><C6B7>:' + Trim(ADOTmp.fieldbyname('PRTCodeName').AsString);
Label25.Visible := True;
Label25.Caption := <><C9AB>:' + Trim(ADOTmp.fieldbyname('SOrddefstr1').AsString);
Label47.Visible := true;
Label47.Caption := '<27><>ɫ:' + Trim(ADOTmp.fieldbyname('PRTcolor').AsString);
FAPID := Trim(ADOTmp.fieldbyname('SubId').AsString);
FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString);
FSubId := Trim(ADOTmp.fieldbyname('SubId').AsString);
FJZ := ADOTmp.fieldbyname('jiazhong').AsFloat;
FJC := ADOTmp.fieldbyname('jiachang').AsFloat;
FDC := StrToFloatDef(ADOTmp.fieldbyname('DC').asstring, 0);
fbaotype := Trim(ADOTmp.fieldbyname('baotype').AsString);
fbaosx := Trim(ADOTmp.fieldbyname('baosx').AsString);
fOrderUnit := uppercase(Trim(ADOTmp.fieldbyname('OrderUnit').AsString));
if FDC <> 0 then
begin
Edit12.Visible := True;
Label51.Visible := True;
Edit12.Text := '<27><>';
end
else
begin
Edit12.Visible := False;
Label51.Visible := False;
Edit12.Text := '';
end;
AOrdDefNote1.Text := '<27><>װҪ<D7B0><D2AA>:' + #13 + Trim(ADOTmp.fieldbyname('MPRTBZNote').AsString) + #13 + '<27><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>:' + #13 + Trim(ADOTmp.fieldbyname('MPRTSCTeBieNote').AsString);
MJQty3.Text := Trim(ADOTmp.fieldbyname('SPiZhong').AsString);
kmxs.Text := Trim(ADOTmp.fieldbyname('kmxs').AsString);
MJFK.Text := Trim(ADOTmp.fieldbyname('PRTMF').AsString);
MJSJKZ.Text := Trim(ADOTmp.fieldbyname('PRTKZ').AsString);
if edit10.Text = '' then
begin
MJXH.Text := inttostr(ADOTmp.fieldbyname('maxMJxh').AsInteger + 1);
end
else
begin
MJXH.Text := inttostr(ADOTmp.fieldbyname('minMJxh').AsInteger - 1);
end;
fxsws := Trim(ADOTmp.fieldbyname('xsws').AsString);
fxsws1 := Trim(ADOTmp.fieldbyname('xsws1').AsString);
baoNO.Text := Trim(ADOTmp.fieldbyname('maxBaoNO').AsString);
Banno.Text := Trim(ADOTmp.fieldbyname('maxBanNO').AsString);
if GetLSNo(ADOCmd, FBaoID, 'BI', 'WFB_MJJY', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if GetLSNo(ADOCmd, FBanid, 'Bn', 'WFB_MJJY', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
baoid.Text := FBaoID;
banid.Text := FBanid;
Edit3.Text := '<27><>';
Edit4.Text := '';
MJStr4.Text := '';
with ADOQueryMain do
begin
Close;
SQL.Clear;
sql.Add('select ');
//sql.Add('Case when isnull(MJType,'''')=''<27><>Ʒ'' then ''B''+RTrim(Cast(MJXH as varchar(20))) else Cast(MJXH as varchar(20)) end as MJXH ,');
// sql.Add(' A.* from WFB_MJJY A where APID=''' + Trim(FAPID) + '''');
sql.Add(' A.*,B.prtcolor from WFB_MJJY A inner join JYOrder_sub B on B.subId=A.subId where A.mainID=''' + Trim(FmainID) + '''');
if Trim(SCXFlag) <> '' then
sql.Add(' and JTType=''' + Trim(SCXFlag) + '''');
sql.Add('and mjstr2='<><CEB4><EFBFBD><EFBFBD>'' ');
SQL.Add('and banno=''' + Trim(Banno.text) + '''');
sql.Add(' order by FillTime desc');
// showmessage(sql.text);
Open;
end;
SCreateCDS20(ADOQueryMain, CDS_MJID);
SInitCDSData20(ADOQueryMain, CDS_MJID);
end
else
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Label2.Visible := False;
Label2.Caption := '';
APID.Text := '';
FAPID := '';
FMainId := '';
FSubId := '';
AOrdDefNote1.Text := '';
MJStr4.Text := '';
fRollType := '';
Exit;
end;
APID.Text := '';
// Banno.Change;
BTAdd.Click;
end;
procedure TfrmMJManageNewFDNewSF.Edit7Click(Sender: TObject);
begin
if Trim(Edit7.Text) = '' then
begin
Edit7.Text := '<27><>';
if not IsCommOpen then
OpenCom(JCYDLL);
IsJsMessage := true;
end
else
begin
Edit7.Text := '';
IsJsMessage := true;
end;
end;
procedure TfrmMJManageNewFDNewSF.Button6Click(Sender: TObject);
begin
frmClothHCList := TfrmClothHCList.create(self);
with frmClothHCList do
begin
fType := '10';
if showmodal = 1 then
begin
APID.Text := trim(Order_Main.fieldbyname('Subid').asstring);
Button3.Click;
end;
free;
end;
end;
procedure TfrmMJManageNewFDNewSF.MJQty4KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
BTPrint.Click;
end;
end;
procedure TfrmMJManageNewFDNewSF.MJXHClick(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 TfrmMJManageNewFDNewSF.MJLenChange(Sender: TObject);
begin
// MJLen.Text:=JsXj(MJLen.Text);
end;
procedure TfrmMJManageNewFDNewSF.MJQty3Change(Sender: TObject);
begin
// MJQty3.Text:=JsXj(MJQty3.Text);
end;
procedure TfrmMJManageNewFDNewSF.MJQty2Change(Sender: TObject);
begin
// MJQty2.Text:=JsXj(MJQty2.Text);
end;
procedure TfrmMJManageNewFDNewSF.MJQty4KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
Tedit(Sender).SelStart := length(Tedit(Sender).Text);
end;
procedure TfrmMJManageNewFDNewSF.MJStr4Exit(Sender: TObject);
begin
if Pstate = 1 then
begin
if fRollType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
sql.Add('from WFB_MJJY X where X.mainID=''' + trim(fMainID) + ''' ');
// sql.add('and X.MJStr4='+quotedstr(trim(MJstr4.text)));
Open;
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
end;
end
else if fRollType = '<27><><EFBFBD>׺<EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
sql.Add('from WFB_MJJY X where X.subID=''' + trim(FSubId) + ''' ');
sql.add('and X.MJStr4=' + quotedstr(trim(MJstr4.text)));
Open;
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
end;
end
else if fRollType = '<27>޹<EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
{ if edit10.Text = '<27><>' then
begin
if fRollType1 = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select maxRoll=isnull(cast(min(mjxh) as int),1)-1 ');
sql.Add('from WFB_MJJY X where X.mainID=''' + trim(fMainID) + ''' ');
Open;
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
end;
end
else if fRollType1 = '<27>޹<EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select maxRoll=isnull(cast(min(mjxh) as int),1)-1 ');
sql.Add('from WFB_MJJY X where X.mainID=''' + trim(fMainID) + ''' ');
Open;
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
end;
end
else if fRollType1 = '<27><><EFBFBD>׺<EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select maxRoll=isnull(cast(min(mjxh) as int),1)-1 ');
sql.Add('from WFB_MJJY X where X.subID=''' + trim(FSubId) + ''' ');
sql.add('and X.MJStr4=' + quotedstr(trim(MJstr4.text)));
Open;
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
end;
end
else if fRollType1 = '<27><><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>' then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select maxRoll=isnull(cast(min(mjxh) as int),1)-1 ');
sql.Add('from WFB_MJJY X where X.subID=''' + trim(FSubId) + ''' ');
Open;
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
end;
end;
end; }
end
else
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select maxRoll=1+isnull(cast(max(mjxh) as int),0) ');
sql.Add('from WFB_MJJY X where X.subID=''' + trim(FSubId) + ''' ');
Open;
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
end;
end;
end;
end;
procedure TfrmMJManageNewFDNewSF.ToolButton2Click(Sender: TObject);
begin
if CDS_MJID.IsEmpty then
exit;
if CDS_MJCD.IsEmpty = False then
begin
if Trim(CDS_MJCD.fieldbyname('MJID').AsString) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
FInt := 4;
PState := 0;
InitCDGrid();
with ADOTmp do
begin
close;
sql.Clear;
sql.Add('select * from WFB_MJJY where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + '''');
Open;
end;
MJFK.Text := Trim(ADOTmp.fieldbyname('MJFK').AsString);
MJSJKZ.Text := Trim(ADOTmp.fieldbyname('MJSJKZ').AsString);
MJQty1.Text := Trim(ADOTmp.fieldbyname('MJQty1').AsString);
MJQty2.Text := Trim(ADOTmp.fieldbyname('MJQty2').AsString);
MJQty3.Text := Trim(ADOTmp.fieldbyname('MJQty3').AsString);
MJQty4.Text := Trim(ADOTmp.fieldbyname('MJQty4').AsString);
MJMaoZ.Text := Trim(ADOTmp.fieldbyname('MJMaoZ').AsString);
Label15.Caption := Trim(CDS_MJID.fieldbyname('MJID').AsString);
MJLen.Text := Trim(ADOTmp.fieldbyname('MJLen').AsString);
MJstr4.Text := Trim(ADOTmp.fieldbyname('MJstr4').AsString);
MJXH.Text := Trim(ADOTmp.fieldbyname('MJXH').AsString);
baoid.Text := Trim(ADOTmp.fieldbyname('baoid').AsString);
baoNo.Text := Trim(ADOTmp.fieldbyname('baoNo').AsString);
banid.Text := Trim(ADOTmp.fieldbyname('banid').AsString);
banNo.Text := Trim(ADOTmp.fieldbyname('banNo').AsString);
if Trim(ADOTmp.fieldbyname('MJType').AsString) = '<27><>Ʒ' then
begin
Edit3.Text := '<27><>';
Edit4.Text := '';
end
else if Trim(ADOTmp.fieldbyname('MJType').AsString) = '<27><>Ʒ' then
begin
Edit4.Text := '<27><>';
Edit3.Text := '';
end;
BtnStatus(False);
Label16.Caption := '';
PState := 2;
end;
procedure TfrmMJManageNewFDNewSF.Edit9Click(Sender: TObject);
begin
if Trim(Edit9.Text) = '' then
begin
Edit9.Text := '<27><>';
end
else
begin
Edit9.Text := '';
end;
end;
procedure TfrmMJManageNewFDNewSF.ToolButton3Click(Sender: TObject);
begin
if CDS_MJID.IsEmpty then
exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
with ADOCmd do
begin
Close;
sql.Clear;
sql.add('insert into WFB_MJJY_Del select * from WFB_MJJY where mjid=''' + trim(CDS_MJID.FieldByName('MJID').AsString) + ''' ');
sql.Add('update WFB_MJJY_Del Set DelTime=Getdate(),Deler=''' + Trim(DName) + ''' where mjid=''' + trim(CDS_MJID.FieldByName('MJID').AsString) + ''' ');
sql.Add('delete WFB_MJJY 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,Mainid) values( ');
sql.Add(' ' + quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>')));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + trim(CDS_MJID.FieldByName('MJID').AsString) + ' ָʾ<D6B8><CABE><EFBFBD><EFBFBD>:' + trim(fsubID) + '<27>׺<EFBFBD>:' + trim(CDS_MJID.FieldByName('MJstr4').AsString) + '<27><><EFBFBD><EFBFBD>:' + trim(CDS_MJID.FieldByName('MJXH').AsString) + '<27><><EFBFBD><EFBFBD>:' + trim(CDS_MJID.FieldByName('MJLen').AsString) + '<27><><EFBFBD><EFBFBD>:' + trim(CDS_MJID.FieldByName('MJQty4').AsString))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(',' + quotedstr(trim(fmainID)));
sql.Add(')');
execsql;
end;
InitCDGridID();
PlaySound('wav\ɾ<><C9BE><EFBFBD>ɹ<EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
end;
procedure TfrmMJManageNewFDNewSF.Button7Click(Sender: TObject);
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
FBaoID: string;
i: Integer;
begin
if CDS_MJID.IsEmpty then
exit;
// CDS_MJID.First;
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add('select A.Baoid,A.BaoNo,A.MJTypeOther as QtyUnit,D.OrderNo,D.conNo,D.customerNoName,D.MprtCodeName,D.Mprtspec,D.OrdPerson1,D.MPRTKuanNO,D.LBName,D.NLBName,C.KHorderNo,');
sql.Add('PRTCodeName=DBO.F_Get_Order_SubStr(BaoID,''BNCodeName''),');
sql.Add('PRTColor=DBO.F_Get_Order_SubStr(BaoID,''BNColor''),SOrddefstr1=DBO.F_Get_Order_SubStr(BaoID,''BNSOrddefstr1''),');
sql.Add('SOrddefstr4=DBO.F_Get_Order_SubStr(BaoID,''BNSOrddefstr4''),PRtHX=DBO.F_Get_Order_SubStr(BaoID,''BNPRtHX''), ');
sql.Add('Mjstr4=DBO.F_Get_Order_SubStr(BaoID,''BNGangNo''), ');
sql.Add('MJXH=DBO.F_Get_Order_SubStr(BaoID,''BNMJXH''), ');
sql.Add('BNMJLENLIST=DBO.F_Get_Order_SubStr(BaoID,''BNMJLENLIST''), ');
sql.Add('PRTkuanNo=DBO.F_Get_Order_SubStr(BaoID,''BNPrtkuanno''),');
sql.Add('khConNo=(select top 1 khConNo from JYOrderCon_Main X where X.ConNO=D.conNO), ');
sql.Add('MprtCodeNameEng=(select top 1 Note from KH_Zdy X where X.zdyName=D.MprtCodeName), ');
SQL.ADD('count(A.MJID) as JSl,sum(A.MJMaoZ) MJMAOZ,sum(MJQty2) as MJQty2,sum(MJQty3) as MJQty3,sum(MJQty4) as MJQty4,SUM(A.MJLen)as MJLen');
sql.Add('from WFB_MJJY A');
sql.Add('inner join JYOrder_Sub C on C.SubID=A.SubID');
sql.Add('inner join JYOrder_Main D on D.MainID=A.MainID');
SQL.Add('where A.BaoID=''' + Trim(CDS_MJID.fieldbyname('baoID').AsString) + '''');
SQL.ADD('group by A.Baoid,A.BaoNo,A.MJTypeOther,D.OrderNo,D.conNo,D.customerNoName,D.MprtCodeName,D.Mprtspec,D.OrdPerson1,D.MPRTKuanNO,D.LBName,D.NLBName,C.KHorderNo');
Open;
end;
if ADOQueryPrint.RecordCount > 1 then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if ADOQueryPrint.RecordCount < 1 then
begin
Application.MessageBox('<27>˰<EFBFBD><CBB0>Ż<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3>ڴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>룡', '<27><>ʾ', 0);
Exit;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := trim(BaoID.Text);
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;
with ADOTmp do
begin
close;
sql.Clear;
sql.Add('select max(cast(baoNO as int)) as maxbaoNO from WFB_MJJY ');
sql.Add('where mainID=' + quotedstr(trim(fmainID)));
if fbaosx = '<27><><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>' then
begin
sql.Add('and subID=' + quotedstr(trim(fsubID)));
end;
open;
end;
baoNo.Text := inttostr(ADOTmp.fieldbyname('maxbaoNO').AsInteger + 1);
if GetLSNo(ADOTmp, FBaoID, 'BI', 'WFB_MJJY', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
BaoID.Text := trim(FBaoID);
if Trim(ADOQueryPrint.fieldbyname('NLBName').AsString) <> '' then
begin
ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('NLbName').AsString), ADOCmd);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('NLbName').AsString)
end
else
begin
ExportFtErpFile('<27><><EFBFBD><EFBFBD>ǩ.rmf', ADOCmd);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ǩ.rmf';
end;
if not FileExists(fPrintFile) then
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD>ҵ<EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
Exit;
end;
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
RM2.LoadFromFile(fPrintFile);
RM2.DefaultCopies := 1;
//RM2.ShowReport;
RM2.printReport;
end;
end;
procedure TfrmMJManageNewFDNewSF.Edit10Click(Sender: TObject);
begin
if Trim(Edit10.Text) = '' then
begin
Edit10.Text := '<27><>';
frolltype1 := frolltype;
frolltype := '<27>޹<EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end
else
begin
Edit10.Text := '';
frolltype := frolltype1;
frolltype1 := '';
end;
end;
procedure TfrmMJManageNewFDNewSF.Edit11Click(Sender: TObject);
begin
if Trim(Edit11.Text) = '' then
begin
Edit11.Text := '<27><>';
end
else
begin
Edit11.Text := '';
end;
end;
procedure TfrmMJManageNewFDNewSF.ToolButton4Click(Sender: TObject);
begin
frmSysLogOrder := TfrmSysLogOrder.create(self);
with frmSysLogOrder do
begin
fModel := self.caption;
frmSysLogOrder.FMainId := Trim(Self.FMainId);
showmodal;
free;
end;
end;
procedure TfrmMJManageNewFDNewSF.MaxRollNoKeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in ['0'..'9']) then
Key := #0;
end;
procedure TfrmMJManageNewFDNewSF.Edit12Click(Sender: TObject);
begin
if Trim(Edit12.Text) = '' then
begin
Edit12.Text := '<27><>';
end
else
begin
Edit12.Text := '';
end;
end;
procedure TfrmMJManageNewFDNewSF.Timer1Timer(Sender: TObject);
begin
btprint.Enabled := True;
Button5.Enabled := True;
Timer1.Enabled := False;
end;
procedure TfrmMJManageNewFDNewSF.TBCDClick(Sender: TObject);
var
fPrintFile: string;
i: Integer;
begin
if CDS_MJID.IsEmpty then
Exit;
MggCDFalg := '99';
PrtData(Trim(CDS_MJID.fieldbyname('MJID').AsString));
Label16.Caption := '';
BTAdd.Click;
MJLen.SetFocus;
MJQty4.OnClick(MJQty4);
end;
procedure TfrmMJManageNewFDNewSF.baoNoExit(Sender: TObject);
var
FBaoID: string;
begin
with ADOTmp do
begin
close;
sql.Clear;
sql.Add('select baoID from WFB_MJJY ');
sql.Add('where mainID=''' + trim(fmainID) + ''' ');
sql.Add('and baoNo=''' + trim(baoNo.Text) + '''');
open;
end;
if ADOTmp.IsEmpty then
begin
application.MessageBox('<27>˰<EFBFBD><CBB0>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
if GetLSNo(ADOTmp, FBaoID, 'BI', 'WFB_MJJY', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
BaoID.Text := trim(FBaoID);
end
else
begin
baoID.Text := trim(ADOTmp.fieldbyName('baoID').AsString);
end;
end;
procedure TfrmMJManageNewFDNewSF.FormCreate(Sender: TObject);
begin
fxsws := '2';
fxsws1 := '2';
end;
procedure TfrmMJManageNewFDNewSF.Button5Click(Sender: TObject);
var
sqlStr: string;
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
FBaoID, FBanid: string;
i: Integer;
begin
if (Banno.Text = '') or (FAPId = '') then
exit;
with ADOTmp do
begin
Close;
SQL.Clear;
sql.Add(' select A.mjid');
sql.Add(' from wfb_mjjy A');
sql.Add(' inner join jyorder_main B on A.mainid=B.mainid');
sql.Add(' inner join jyorder_sub C on A.subid=C.subid');
sql.Add(' where A.banno=''' + trim(Banno.Text) + ''' and A.mainID=''' + trim(fMainID) + ''' ');
// sql.Add(' where A.banno=''' + trim(Banno.Text) + ''' and A.subid=''' + trim(FAPId) + '''');
Open;
end;
if ADOTmp.IsEmpty then
Exit;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('delete TBsubID where DName=''' + Trim(DCode) + '''');
ExecSQL;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('SELECT * FROM TBsubID where 1=2 ');
open;
end;
sqlStr := '';
with ADOTmp do
begin
First;
while not Eof do
begin
sqlStr := sqlStr + 'insert into TBsubID(subId,Dname) ';
sqlStr := sqlStr + ' values( ';
sqlStr := sqlStr + ' ''' + Trim(ADOTmp.fieldbyname('MJID').AsString) + ''', ';
sqlStr := sqlStr + ' ''' + Trim(DCode) + ''' ';
sqlStr := sqlStr + ' ) ';
Next;
end;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add(sqlStr);
ExecSQL;
end;
with ADOQueryPrint do
begin
Close;
sql.Clear;
sql.add('exec P_Do_PrintMd30_copy1 ');
sql.add('@DName=' + quotedstr(Trim(DCode)));
SQL.Add(',@JTType=' + QuotedStr(SCXFlag));
sql.add('update WFB_MJJY set banflag= 1 from WFB_MJJY A ');
SQL.Add(' where A.banno=''' + trim(Banno.Text) + ''' and A.mainID=''' + trim(fMainID) + '''');
// SQL.Add(' where A.banno=''' + trim(Banno.Text) + ''' and A.subid=''' + trim(FAPId) + '''');
Open;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(banid.text);
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 GetLSNo(ADOTmp, FBanid, 'Bn', 'WFB_MJJY', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
BanID.Text := trim(FBanid);
ExportFtErpFile('<27><><EFBFBD><EFBFBD>ǩ.rmf', ADOCmd);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ǩ.rmf';
if not FileExists(fPrintFile) then
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
Exit;
end;
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
RM2.LoadFromFile(fPrintFile);
RM2.DefaultCopies := 2;
// RM2.ShowReport;
RM2.printReport;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select maxBanNO=1+isnull((select max(cast(ISNULL(BanNO,0) as Int)) from WFB_MJJY X where X.mainID=''' + trim(fMainID) + '''),1)');
sql.Add('from WFB_MJJY X where X.mainID=''' + trim(fMainID) + ''' ');
// sql.Add('select maxBanNO=1+isnull((select max(cast(ISNULL(BanNO,0) as Int)) from WFB_MJJY X where X.subid=''' + trim(FAPId) + '''),1)');
// sql.Add('from WFB_MJJY X where X.subid=''' + trim(FAPId) + ''' ');
Open;
BanNO.Text := Trim(fieldbyname('maxBanNO').AsString);
end;
end;
procedure TfrmMJManageNewFDNewSF.BannoChange(Sender: TObject);
begin
with ADOQueryMain do
begin
Close;
SQL.Clear;
sql.Add('select ');
//sql.Add('Case when isnull(MJType,'''')=''<27><>Ʒ'' then ''B''+RTrim(Cast(MJXH as varchar(20))) else Cast(MJXH as varchar(20)) end as MJXH ,');
// sql.Add(' A.* from WFB_MJJY A where APID=''' + Trim(FAPID) + '''');
sql.Add(' A.*,B.prtcolor from WFB_MJJY A inner join JYOrder_sub B on B.subId=A.subId where A.mainID=''' + Trim(FmainID) + '''');
if Trim(SCXFlag) <> '' then
sql.Add(' and JTType=''' + Trim(SCXFlag) + '''');
sql.Add('and mjstr2='<><CEB4><EFBFBD><EFBFBD>'' ');
SQL.Add('and banno=''' + Trim(Banno.text) + '''');
sql.Add(' order by FillTime desc');
// showmessage(sql.text);
Open;
end;
SCreateCDS20(ADOQueryMain, CDS_MJID);
SInitCDSData20(ADOQueryMain, CDS_MJID);
end;
procedure TfrmMJManageNewFDNewSF.BannoExit(Sender: TObject);
var
FBanID: string;
begin
with ADOTmp do
begin
close;
sql.Clear;
sql.Add('select banID from WFB_MJJY ');
sql.Add('where mainID=''' + trim(fmainID) + ''' ');
sql.Add('and banNo=''' + trim(banNo.Text) + '''');
open;
end;
if ADOTmp.IsEmpty then
begin
application.MessageBox('<27>˰<EFBFBD><CBB0>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
if GetLSNo(ADOTmp, FBanID, 'Bn', 'WFB_MJJY', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
BanID.Text := trim(FBanID);
end
else
begin
banID.Text := trim(ADOTmp.fieldbyName('banID').AsString);
end;
end;
end.