D7djLingxi/检验管理/U_MJManageNewFDNew.pas

2521 lines
69 KiB
ObjectPascal
Raw Permalink Normal View History

2025-01-21 15:30:43 +08:00
unit U_MJManageNewFDNew;
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,
2025-09-19 16:22:04 +08:00
RM_System, RM_Dataset, ADODB, DBClient, cxGridCustomPopupMenu, cxGridPopupMenu,
ExtCtrls, ComCtrls, ToolWin, cxTextEdit, Buttons, cxSplitter, cxCheckBox,
MovePanel, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinBlack,
dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinsDefaultPainters,
dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue,
dxSkinscxPCPainter, cxNavigator;
2025-01-21 15:30:43 +08:00
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;
SpeedButton21: TSpeedButton;
SpeedButton22: TSpeedButton;
SpeedButton23: TSpeedButton;
SpeedButton24: TSpeedButton;
SpeedButton25: TSpeedButton;
SpeedButton26: TSpeedButton;
SpeedButton29: TSpeedButton;
SpeedButton30: TSpeedButton;
SpeedButton31: TSpeedButton;
SpeedButton32: TSpeedButton;
SpeedButton33: TSpeedButton;
SpeedButton34: TSpeedButton;
SpeedButton37: TSpeedButton;
SpeedButton38: TSpeedButton;
SpeedButton39: 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;
SpeedButton48: TSpeedButton;
SpeedButton50: TSpeedButton;
SpeedButton51: TSpeedButton;
SpeedButton54: TSpeedButton;
SpeedButton55: TSpeedButton;
SpeedButton56: TSpeedButton;
SpeedButton57: TSpeedButton;
SpeedButton58: TSpeedButton;
SpeedButton59: TSpeedButton;
SpeedButton62: TSpeedButton;
SpeedButton63: TSpeedButton;
SpeedButton64: TSpeedButton;
SpeedButton65: TSpeedButton;
SpeedButton66: TSpeedButton;
SpeedButton67: 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;
Button5: 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;
MJQty5: TEdit;
Label28: TLabel;
Edit5: TEdit;
Label26: TLabel;
Edit6: TEdit;
Label29: TLabel;
MJstr3: TEdit;
Label30: TLabel;
MJQty3: TEdit;
Label31: TLabel;
Label32: TLabel;
MJQty4: TEdit;
Label33: TLabel;
Panel4: TPanel;
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;
Panel5: TPanel;
Panel6: TPanel;
Label1: TLabel;
Label2: TLabel;
Label16: TLabel;
Label24: TLabel;
Label25: TLabel;
APID: TEdit;
BTAdd: TButton;
BTEdit: TButton;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
TBCD: TToolButton;
TBClose: TToolButton;
Panel7: TPanel;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
tv2CDType: TcxGridDBColumn;
tv2CDWZ: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
Tv2CDQty: TcxGridDBColumn;
Tv2CDReason: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
Panel8: TPanel;
Button3: TButton;
AOrdDefNote1: TRichEdit;
Label34: TLabel;
ComboBox1: TComboBox;
Edit7: TEdit;
Label35: TLabel;
SpeedButton19: TSpeedButton;
SpeedButton20: TSpeedButton;
SpeedButton27: TSpeedButton;
SpeedButton28: TSpeedButton;
SpeedButton35: TSpeedButton;
SpeedButton36: TSpeedButton;
SpeedButton43: TSpeedButton;
SpeedButton44: TSpeedButton;
SpeedButton52: TSpeedButton;
SpeedButton53: TSpeedButton;
SpeedButton60: TSpeedButton;
SpeedButton61: TSpeedButton;
SpeedButton68: TSpeedButton;
SpeedButton69: TSpeedButton;
SpeedButton76: TSpeedButton;
SpeedButton77: TSpeedButton;
SpeedButton78: TSpeedButton;
SpeedButton79: TSpeedButton;
SpeedButton80: TSpeedButton;
SpeedButton81: TSpeedButton;
SpeedButton82: TSpeedButton;
SpeedButton83: TSpeedButton;
v3Column4: TcxGridDBColumn;
Button6: TButton;
Label36: TLabel;
MJStr4: TEdit;
Label37: TLabel;
MJXH: TEdit;
v3Column5: TcxGridDBColumn;
Label38: TLabel;
ToolButton2: TToolButton;
kmxs: TEdit;
Label39: TLabel;
MJstr5: TEdit;
Label40: TLabel;
Label41: TLabel;
Edit8: TEdit;
Label42: TLabel;
v2Column4: TcxGridDBColumn;
note: TEdit;
Label43: TLabel;
Label44: TLabel;
Edit9: TEdit;
ToolButton3: TToolButton;
baoNo: TEdit;
Label45: TLabel;
BaoID: TEdit;
Button7: TButton;
Label46: TLabel;
v3Column6: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
2025-09-19 16:22:04 +08:00
procedure Tv2CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-01-21 15:30:43 +08:00
procedure TBCDClick(Sender: TObject);
procedure FormShow(Sender: TObject);
2025-09-19 16:22:04 +08:00
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-01-21 15:30:43 +08:00
procedure MJMaoZClick(Sender: TObject);
procedure MJLenClick(Sender: TObject);
procedure MJFKClick(Sender: TObject);
procedure MJBanZuClick(Sender: TObject);
procedure MJSJKZClick(Sender: TObject);
2025-09-19 16:22:04 +08:00
procedure Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-01-21 15:30:43 +08:00
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 ToolButton1Click(Sender: TObject);
procedure Button5Click(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 Edit5Click(Sender: TObject);
procedure Edit6Click(Sender: TObject);
procedure MJstr3KeyPress(Sender: TObject; var Key: Char);
procedure MJQty3Exit(Sender: TObject);
procedure MJMaoZExit(Sender: TObject);
procedure Label9Click(Sender: TObject);
procedure MJLenExit(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 MJQty5Change(Sender: TObject);
2025-09-19 16:22:04 +08:00
procedure MJQty4KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
2025-01-21 15:30:43 +08:00
procedure MJStr4Exit(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure Edit9Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
private
{ Private declarations }
2025-09-19 16:22:04 +08:00
FInt, PState, PrintInt, SCInitGrid, FState, FCK: Integer;
FColumn, FBanZu, FAPID, FMainId, FSubId, FFFMJID: string;
fRollType: string;
isCommopen, IsJsMessage: boolean;
MValue, FCDName: string;
fxsws, fxsws1: string;
2025-01-21 15:30:43 +08:00
procedure InitJP();
procedure InitCDGrid();
procedure InitCDGridID();
2025-09-19 16:22:04 +08:00
procedure AddCD(Fbtn: TButton);
procedure AddSL(Fbtn: TButton);
function SaveData(): Boolean;
procedure BtnStatus(BSInt: Boolean);
procedure AddSLNew(Fbtn: TSpeedButton);
procedure AddCDNew(Fbtn: TSpeedButton);
2025-01-21 15:30:43 +08:00
procedure SavedataCK();
2025-09-19 16:22:04 +08:00
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;
2025-01-21 15:30:43 +08:00
public
2025-09-19 16:22:04 +08:00
fmanage: string;
2025-01-21 15:30:43 +08:00
{ Public declarations }
end;
var
frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF;
2025-09-19 16:22:04 +08:00
newh, newh1: hwnd;
2025-01-21 15:30:43 +08:00
implementation
2025-09-19 16:22:04 +08:00
2025-01-21 15:30:43 +08:00
uses
2025-09-19 16:22:04 +08:00
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_ClothHCList;
2025-01-21 15:30:43 +08:00
{$R *.dfm}
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.On1301(var Message: Tmessage);
2025-01-21 15:30:43 +08:00
var
2025-09-19 16:22:04 +08:00
i1, i2: integer;
unitname: string;
fdata: double;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
i1 := Message.WParam;
i2 := Message.LParam;
if IsJsMessage then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if (trim(Edit7.Text) = '<27><>') then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
MJLen.Text := format('%.' + trim(fxsws) + 'f', [i1 / 100000]);
if i2 = 0 then
Label9.Caption := 'M'
else
Label9.Caption := 'Y';
edit1.Text := format('%.' + trim(fxsws) + 'f', [i1 / 100000]);
2025-01-21 15:30:43 +08:00
end;
end;
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.On1201(var Message: Tmessage);
2025-01-21 15:30:43 +08:00
var
2025-09-19 16:22:04 +08:00
i1, i2: integer;
unitname: string;
fdata: double;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
i1 := Message.WParam;
i2 := Message.LParam;
if IsJsMessage then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if trim(Edit9.Text) = '<27><>' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
MJMaoZ.Text := format('%.' + trim(fxsws1) + 'f', [i1 / 100000]);
2025-01-21 15:30:43 +08:00
end;
end;
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.CloseCom(DllName: string);
2025-01-21 15:30:43 +08:00
type
2025-09-19 16:22:04 +08:00
TMyFunc = function(sCommName: PAnsiChar): HWND; stdcall;
2025-01-21 15:30:43 +08:00
var
Tf1: TMyFunc;
Tp1: TFarProc;
2025-09-19 16:22:04 +08:00
Th1: Thandle;
2025-01-21 15:30:43 +08:00
begin
Th1 := LoadLibrary(Pchar(trim(DllName)));
if Th1 > 0 then
begin
try
Tp1 := GetProcAddress(Th1, 'CommClose');
if Tp1 <> nil then
begin
Tf1 := TMyFunc(Tp1);
2025-09-19 16:22:04 +08:00
newh1 := Tf1('Comm1');
2025-01-21 15:30:43 +08:00
end
else
begin
end;
finally
// FreeLibrary(Th1);
end;
end
else
begin
2025-09-19 16:22:04 +08:00
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
2025-01-21 15:30:43 +08:00
end;
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.OpenCom(DllName: string);
2025-01-21 15:30:43 +08:00
type
2025-09-19 16:22:04 +08:00
TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): HWND; stdcall;
2025-01-21 15:30:43 +08:00
var
2025-09-19 16:22:04 +08:00
Tf: TMyFunc;
Tp: TFarProc;
Th: Thandle;
2025-01-21 15:30:43 +08:00
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);
2025-09-19 16:22:04 +08:00
newh := Tf(self.Handle, 'Comm1', 500, 1);
if newh < 1 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
application.MessageBox(Pchar('<27>򿪴<EFBFBD><F2BFAAB4><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>'), '<27><>ʾ');
2025-01-21 15:30:43 +08:00
end
else
2025-09-19 16:22:04 +08:00
IsCommOpen := true;
2025-01-21 15:30:43 +08:00
end
else
begin
2025-09-19 16:22:04 +08:00
IsCommOpen := false;
2025-01-21 15:30:43 +08:00
end;
finally
// FreeLibrary(Th);
end;
end
else
begin
2025-09-19 16:22:04 +08:00
IsCommOpen := false;
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
2025-01-21 15:30:43 +08:00
end;
end;
2025-09-19 16:22:04 +08:00
function TfrmMJManageNewFDNewSF.JsXj(str1: string): string;
2025-01-21 15:30:43 +08:00
begin
{ str1:=trim(str1);
result:=str1;
str1:=StringReplace(str1,'.','',[rfReplaceAll]);
IF length(str1)<1 then exit;
try
IF length(str1)>1 then
str1:=inttostr(strtoint(copy(str1,1,length(str1)-1)))+'.'+copy(str1,length(str1),1)
else
str1:='0.'+copy(str1,length(str1),1);
result:=str1;
except
end; }
end;
2025-09-19 16:22:04 +08:00
2025-01-21 15:30:43 +08:00
procedure TfrmMJManageNewFDNewSF.FormDestroy(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
frmMJManageNewFDNewSF := nil;
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.FormClose(Sender: TObject; var Action: TCloseAction);
2025-01-21 15:30:43 +08:00
begin
//DataLink_WFBProducttion.ADOLink.Connected:=False;
2025-09-19 16:22:04 +08:00
Action := caFree;
if isCommopen then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if trim(DllName) <> '' then
closeCom(DllName);
if trim(JCYDLL) <> '' then
closeCom(JCYDLL);
2025-01-21 15:30:43 +08:00
end;
end;
2025-09-19 16:22:04 +08:00
2025-01-21 15:30:43 +08:00
procedure TfrmMJManageNewFDNewSF.InitCDGrid();
begin
with ADOQueryMain do
begin
Close;
SQL.Clear;
2025-09-19 16:22:04 +08:00
if PState = 1 then
2025-01-21 15:30:43 +08:00
sql.Add('select * from WFB_MJJY_CD where MJID='''' ')
else
2025-09-19 16:22:04 +08:00
sql.Add('select * from WFB_MJJY_CD where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + '''');
2025-01-21 15:30:43 +08:00
Open;
end;
2025-09-19 16:22:04 +08:00
SCreateCDS20(ADOQueryMain, CDS_MJCD);
SInitCDSData20(ADOQueryMain, CDS_MJCD);
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
2025-01-21 15:30:43 +08:00
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 ,');
2025-09-19 16:22:04 +08:00
sql.Add(' A.* from WFB_MJJY A where APID=''' + Trim(FAPID) + '''');
if Trim(SCXFlag) <> '' then
sql.Add(' and JTType=''' + Trim(SCXFlag) + '''');
2025-01-21 15:30:43 +08:00
sql.Add('and mjstr2='<><CEB4><EFBFBD><EFBFBD>'' ');
sql.Add(' order by FillTime desc');
Open;
end;
2025-09-19 16:22:04 +08:00
SCreateCDS20(ADOQueryMain, CDS_MJID);
SInitCDSData20(ADOQueryMain, CDS_MJID);
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.TBCloseClick(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
maxno: string;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if CDS_MJCD.IsEmpty = False then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if Trim(CDS_MJCD.FieldByName('MCID').AsString) = '' then
2025-01-21 15:30:43 +08:00
begin
//try
//ADOCmd.Connection.BeginTrans;
{with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('delete from WFB_MJJY_CD_Temp where JTType='''+Trim(SCXFlag)+'''');
Execsql;
end;
with CDS_MJCD do
begin
First;
while not Eof do
begin
if GetLSNo(ADOCmd,maxno,'LS','WFB_MJJY_CD_Temp',2,1)=False then
begin
// ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<>õ<EFBFBD><C3B5><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFB_MJJY_CD_Temp where 1<>1');
Open;
end;
with ADOCmd do
begin
Append;
FieldByName('MCID').Value:=Trim(maxno);
SSetSaveDataCDSNew(ADOCmd,Tv2,CDS_MJCD,'WFB_MJJY_CD_Temp',0);
FieldByName('JTType').Value:=Trim(SCXFlag);
Post;
end;
Next;
end;
end; }
2025-09-19 16:22:04 +08:00
close;
2025-01-21 15:30:43 +08:00
//ADOCmd.Connection.CommitTrans;
//ModalResult:=1;
//except
//ADOCmd.Connection.RollbackTrans;
//Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
//end;
2025-09-19 16:22:04 +08:00
end
else
2025-01-21 15:30:43 +08:00
begin
Close;
end;
2025-09-19 16:22:04 +08:00
end
else
2025-01-21 15:30:43 +08:00
begin
Close;
end;
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.Tv2CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-01-21 15:30:43 +08:00
var
2025-09-19 16:22:04 +08:00
fsj: string;
2025-01-21 15:30:43 +08:00
begin
//FInt:=0;
//Tv1.DataController.FocusedRecordIndex;
//fsj:=Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName;
end;
procedure TfrmMJManageNewFDNewSF.TBCDClick(Sender: TObject);
begin
try
2025-09-19 16:22:04 +08:00
frmZDYHelp := TfrmZDYHelp.Create(Application);
2025-01-21 15:30:43 +08:00
with frmZDYHelp do
begin
2025-09-19 16:22:04 +08:00
flag := 'WFBCD';
flagname := '<27>õ<EFBFBD>';
fnote := True;
V1Note.Caption := <><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
2025-01-21 15:30:43 +08:00
begin
Self.InitJP();
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmMJManageNewFDNewSF.FormShow(Sender: TObject);
begin
InitJP();
with ADOTmp do
begin
Close;
sql.Clear;
2025-09-19 16:22:04 +08:00
sql.Add('select BanZu from SY_User where UserId=''' + Trim(DCode) + '''');
2025-01-21 15:30:43 +08:00
Open;
2025-09-19 16:22:04 +08:00
FBanZu := Trim(Fieldbyname('BanZu').AsString);
2025-01-21 15:30:43 +08:00
end;
{if Trim(FBanZu)='' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ð<EFBFBD><C3B0>飡','<27><>ʾ',0);
Exit;
end; }
APID.SetFocus;
{if CommOpen(frmMJManageNewFDNewSF.Handle,pchar(PortNoStr),500,1)<1 then
begin
FCK:=1;
showmessage('<27><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>ʧ<EFBFBD><CAA7>!');
end else
begin
FCk:=9;
end; }
2025-09-19 16:22:04 +08:00
if trim(Edit7.Text) = '<27><>' then
IsJsMessage := true;
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
if trim(fmanage) <> '<27><>Ȩ<EFBFBD><C8A8>' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if trim(DllName) <> '' then
OpenCom(DllName);
if trim(JCYDLL) <> '' then
OpenCom(JCYDLL);
Edit7.Visible := true;
Label35.Visible := true;
Edit9.Visible := true;
Label44.Visible := true;
2025-01-21 15:30:43 +08:00
end;
end;
2025-09-19 16:22:04 +08:00
2025-01-21 15:30:43 +08:00
procedure TfrmMJManageNewFDNewSF.InitJP();
var
2025-09-19 16:22:04 +08:00
AA: array[0..100] of string;
i, j: Integer;
2025-01-21 15:30:43 +08:00
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
2025-09-19 16:22:04 +08:00
Application.MessageBox(<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>õ㣡', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
Exit;
end;
with ADOTmp do
begin
First;
2025-09-19 16:22:04 +08:00
i := 0;
2025-01-21 15:30:43 +08:00
while not Eof do
begin
2025-09-19 16:22:04 +08:00
AA[i] := Trim(fieldbyname('ZDYName').AsString);
i := i + 1;
2025-01-21 15:30:43 +08:00
Next;
end;
end;
2025-09-19 16:22:04 +08:00
i := i - 1;
if i > 69 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
i := 69;
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
for j := 0 to i do
2025-01-21 15:30:43 +08:00
begin
with ScrollBox1 do
begin
2025-09-19 16:22:04 +08:00
TSpeedButton(Controls[j]).Visible := True;
TSpeedButton(Controls[j]).Hint := AA[j];
if Length(AA[j]) > 4 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
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];
2025-01-21 15:30:43 +08:00
end;
end;
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.AddCD(Fbtn: TButton);
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if PState < 1 then
Exit;
if Order_MJ.IsEmpty then
Exit;
2025-01-21 15:30:43 +08:00
with CDS_MJCD do
begin
Append;
2025-09-19 16:22:04 +08:00
FieldByName('cdname').Value := Trim(TButton(Fbtn).Caption);
2025-01-21 15:30:43 +08:00
Post;
end;
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.AddCDNew(Fbtn: TSpeedButton);
2025-01-21 15:30:43 +08:00
begin
with CDS_MJCD do
begin
Append;
2025-09-19 16:22:04 +08:00
FieldByName('cdname').Value := Trim(TSpeedButton(Fbtn).Hint);
2025-01-21 15:30:43 +08:00
Post;
end;
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.AddSL(Fbtn: TButton);
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if PState < 1 then
Exit;
if Order_MJ.IsEmpty then
Exit;
2025-01-21 15:30:43 +08:00
//if MJMaoZ.Focused then
2025-09-19 16:22:04 +08:00
if FInt = 4 then
Exit;
if CDS_MJCD.IsEmpty = False then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FColumn := Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName;
if Trim(FColumn) <> '' then
2025-01-21 15:30:43 +08:00
begin
with CDS_MJCD do
begin
Edit;
2025-09-19 16:22:04 +08:00
FieldByName(FColumn).Value := Trim(FieldByName(FColumn).AsString) + Trim(TButton(Fbtn).Caption);
if Trim(fieldbyname('CDQtyS').AsString) <> '' then
Fieldbyname('CDQty').Value := Trim(fieldbyname('CDQtyS').AsString);
2025-01-21 15:30:43 +08:00
Post;
end;
end;
end;
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.AddSLNew(Fbtn: TSpeedButton);
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if PState < 1 then
Exit;
if Trim(FAPID) = '' then
Exit;
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
if FInt = 4 then
Exit;
if FInt = 11 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if TSpeedButton(Fbtn).Tag = 9 then
Exit;
Edit1.Text := Trim(Edit1.Text) + Trim(TSpeedButton(Fbtn).Caption);
2025-01-21 15:30:43 +08:00
Edit1.SelectAll;
2025-09-19 16:22:04 +08:00
end
else if FInt = 12 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if TSpeedButton(Fbtn).Tag = 9 then
Exit;
Edit2.Text := Trim(Edit2.Text) + Trim(TSpeedButton(Fbtn).Caption);
2025-01-21 15:30:43 +08:00
Edit2.SelectAll;
end;
{ else
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;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-01-21 15:30:43 +08:00
begin
//if Tv2.OptionsSelection.CellSelect=True then
2025-09-19 16:22:04 +08:00
if CDS_MJCD.IsEmpty then
Exit;
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
2025-01-21 15:30:43 +08:00
CDS_MJCD.Delete;
end;
end;
procedure TfrmMJManageNewFDNewSF.MJMaoZClick(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
FInt := 1;
FColumn := '';
panel3.Visible := True;
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.MJLenClick(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
FInt := 2;
FColumn := '';
panel3.Visible := True;
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.MJFKClick(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
FInt := 3;
FColumn := '';
panel3.Visible := True;
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.MJBanZuClick(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
FInt := 4;
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.MJSJKZClick(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
FInt := 4;
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2025-01-21 15:30:43 +08:00
begin
//DataLink_WFBProducttion.ADOLink.Connected:=False;
2025-09-19 16:22:04 +08:00
FInt := 4;
2025-01-21 15:30:43 +08:00
// 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
2025-09-19 16:22:04 +08:00
FInt := 4;
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.Button12Click(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
fsj: string;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if PState < 1 then
Exit;
if Trim(FAPID) = '' then
Exit;
if FInt = 4 then
Exit;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FColumn := Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName;
if Trim(FColumn) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if Trim(CDS_MJCD.FieldByName(FColumn).AsString) <> '' then
2025-01-21 15:30:43 +08:00
begin
with CDS_MJCD do
begin
Edit;
2025-09-19 16:22:04 +08:00
if Length(CDS_MJCD.FieldByName(FColumn).AsString) = 1 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName(FColumn).Value := null;
FieldByName('CDQty').Value := 0;
2025-01-21 15:30:43 +08:00
end
else
begin
2025-09-19 16:22:04 +08:00
FieldByName(FColumn).Value := Copy(Trim(FieldByName(FColumn).AsString), 1, Length(Trim(FieldByName(FColumn).AsString)) - 1);
FieldByName('CDQty').Value := FieldByName(FColumn).Value;
2025-01-21 15:30:43 +08:00
end;
Post;
end;
end;
end;
end;
end;
2025-09-19 16:22:04 +08:00
function TfrmMJManageNewFDNewSF.SaveData(): Boolean;
2025-01-21 15:30:43 +08:00
var
2025-09-19 16:22:04 +08:00
maxno, FMJID, BZID, strsql: string;
FMJLen: Double;
FOrder: Integer;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
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;
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
if PState = 1 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if fRollType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
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;
2025-01-21 15:30:43 +08:00
end
2025-09-19 16:22:04 +08:00
else if fRollType = '<27><><EFBFBD>׺<EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
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;
2025-01-21 15:30:43 +08:00
end
2025-09-19 16:22:04 +08:00
else if fRollType = '<27>޹<EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
2025-01-21 15:30:43 +08:00
begin
end
else
begin
2025-09-19 16:22:04 +08:00
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;
2025-01-21 15:30:43 +08:00
end;
end;
try
ADOCmd.Connection.BeginTrans;
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
2025-09-19 16:22:04 +08:00
SQL.Add('select * from WFB_MJJY where MJId=''' + Trim(FMJID) + '''');
2025-01-21 15:30:43 +08:00
Open;
end;
with ADOCmd do
begin
2025-09-19 16:22:04 +08:00
if Trim(FMJID) = '' then
2025-01-21 15:30:43 +08:00
begin
Append;
2025-09-19 16:22:04 +08:00
if GetLSNo(ADOTmp, maxno, Trim(SCXFlag), 'WFB_MJJY', 4, 1) = False then
2025-01-21 15:30:43 +08:00
begin
ADOCmd.Connection.RollbackTrans;
2025-09-19 16:22:04 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
exit;
end;
end
2025-09-19 16:22:04 +08:00
else
begin
maxno := Trim(FMJID);
2025-01-21 15:30:43 +08:00
Edit;
end;
2025-09-19 16:22:04 +08:00
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('MJLen').Value := StrToFloatdef(trim(MJLen.Text), 0);
FieldByName('MJQty1').Value := StrToFloatdef(trim(MJQty1.Text), 0);
2025-01-21 15:30:43 +08:00
// FieldByName('MJQty2').Value:=StrToFloatdef(trim(MJQty2.Text),0);
2025-09-19 16:22:04 +08:00
FieldByName('MJQty3').Value := StrToFloatdef(trim(MJQty3.Text), 0);
FieldByName('MJQty4').Value := StrToFloatdef(trim(MJQty4.Text), 0);
FieldByName('MJQty5').Value := StrToFloatdef(trim(MJQty5.Text), 0);
if Trim(MJFK.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('MJFK').Value := StrToFloat(MJFK.Text);
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
if Trim(MJMaoZ.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('MJMaoZ').Value := StrToFloat(MJMaoZ.Text);
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
if Trim(MJSJKZ.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('MJSJKZ').Value := StrToFloat(MJSJKZ.Text);
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
FieldByName('MJType').Value := '';
if Trim(Edit3.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('MJType').Value := '<27><>Ʒ';
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
if Trim(Edit4.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('MJType').Value := '<27><>Ʒ';
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
FieldByName('MJStr1').Value := Trim(Label13.Caption);
if Trim(FMJID) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('Filler').Value := Trim(DName);
end
else
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('Editer').Value := Trim(DName);
FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp);
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
if Trim(SCXFlag) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('JTType').Value := Trim(SCXFlag);
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
FieldByName('MJTypeOther').Value := Trim(Label9.Caption);
FieldByName('note').Value := Trim(note.Text);
2025-01-21 15:30:43 +08:00
// FieldByName('baoNO').Value:=Trim(baono.text);
// FieldByName('baoID').Value:=Trim(baoID.Text);
Post;
end;
2025-09-19 16:22:04 +08:00
if PState = 1 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if fRollType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
2025-01-21 15:30:43 +08:00
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)');
2025-09-19 16:22:04 +08:00
sql.Add('where MJID=''' + Trim(maxno) + '''');
2025-01-21 15:30:43 +08:00
execsql;
end;
end
2025-09-19 16:22:04 +08:00
else if fRollType = '<27><><EFBFBD>׺<EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
2025-01-21 15:30:43 +08:00
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.mjstr4=WFB_MJJY.mjstr4 and X.MJID<>WFB_MJJY.MJID),0)');
2025-09-19 16:22:04 +08:00
sql.Add('where MJID=''' + Trim(maxno) + '''');
2025-01-21 15:30:43 +08:00
execsql;
end;
end
2025-09-19 16:22:04 +08:00
else if fRollType = '<27>޹<EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
2025-01-21 15:30:43 +08:00
begin
with ADOCmd do
begin
end;
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)');
2025-09-19 16:22:04 +08:00
sql.Add('where MJID=''' + Trim(maxno) + '''');
2025-01-21 15:30:43 +08:00
execsql;
end;
end;
end;
2025-09-19 16:22:04 +08:00
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
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
MJXH.Text := fieldbyname('mjxh').AsString;
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
end;
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
FMJID := Trim(maxno);
FFFMJID := Trim(maxno);
2025-01-21 15:30:43 +08:00
///<2F><><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>
with CDS_MJCD do
begin
First;
while not Eof do
begin
2025-09-19 16:22:04 +08:00
if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if GetLSNo(ADOTmp, maxno, 'MC', 'WFB_MJJY_CD', 5, 1) = False then
2025-01-21 15:30:43 +08:00
begin
ADOCmd.Connection.RollbackTrans;
2025-09-19 16:22:04 +08:00
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
Exit;
end;
2025-09-19 16:22:04 +08:00
end
else
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
maxno := Trim(CDS_MJCD.fieldbyname('MCID').AsString);
2025-01-21 15:30:43 +08:00
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from WFB_MJJY_CD ');
2025-09-19 16:22:04 +08:00
sql.Add(' where MCID=''' + Trim(maxno) + '''');
2025-01-21 15:30:43 +08:00
Open;
end;
with ADOCmd do
begin
2025-09-19 16:22:04 +08:00
if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
2025-01-21 15:30:43 +08:00
Append
else
Edit;
2025-09-19 16:22:04 +08:00
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;
2025-01-21 15:30:43 +08:00
Post;
end;
CDS_MJCD.Edit;
2025-09-19 16:22:04 +08:00
CDS_MJCD.FieldByName('MCID').Value := Trim(maxno);
2025-01-21 15:30:43 +08:00
Next;
end;
end;
with CDS_MJID do
begin
Append;
2025-09-19 16:22:04 +08:00
FieldByName('MJID').Value := Trim(FMJID);
2025-01-21 15:30:43 +08:00
Post;
end;
with ADOCmd do
begin
close;
sql.Clear;
sql.Add('update WFB_MJJY SET CDList= dbo.F_Get_Order_SubStr(MJID,''MJCDHZSL'')');
2025-09-19 16:22:04 +08:00
sql.Add('where MJID=''' + Trim(FMJID) + ''' ');
2025-01-21 15:30:43 +08:00
execsql;
end;
//SavedataCK();
ADOCmd.Connection.CommitTrans;
2025-09-19 16:22:04 +08:00
Result := True;
2025-01-21 15:30:43 +08:00
// PState:=0;
except
2025-09-19 16:22:04 +08:00
Result := False;
2025-01-21 15:30:43 +08:00
ADOCmd.Connection.RollbackTrans;
2025-09-19 16:22:04 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
end;
end;
procedure TfrmMJManageNewFDNewSF.BTAddClick(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
if Trim(Label24.Caption) = '' then
Exit;
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
PState := 1;
2025-01-21 15:30:43 +08:00
InitCDGridID();
InitCDGrid();
BtnStatus(True);
2025-09-19 16:22:04 +08:00
Label16.Caption := '<27><><EFBFBD><EFBFBD>';
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.BTEditClick(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
if CDS_MJID.IsEmpty then
Exit;
PState := 2;
Label16.Caption := '<27>޸<EFBFBD>';
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.BTPrintClick(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
fPrintFile: string;
mvalue: Double;
mvalue1: integer;
i: Integer;
2025-01-21 15:30:43 +08:00
begin
{ if trim(MJLen.Text)='' then
begin
application.MessageBox('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end; }
{ IF strtofloatdef(trim(mjqty4.Text),0)<4 then
begin
application.MessageBox('<27><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>С<EFBFBD><D0A1>4KG','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end;
IF strtofloatdef(trim(mjqty4.Text),0)>40 then
begin
application.MessageBox('<27><><EFBFBD>ز<EFBFBD><D8B2>ܴ<EFBFBD><DCB4><EFBFBD>40KG','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end; }
2025-09-19 16:22:04 +08:00
if (strtofloatdef(trim(MJLen.Text), 0) = 0) and (strtofloatdef(trim(mjqty4.Text), 0) = 0) then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
application.MessageBox('<27><><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>Ϊ<EFBFBD>㣡', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
2025-01-21 15:30:43 +08:00
exit;
end;
// if Trim(MJstr4.Text)<>'' then
// begin
// if TryStrToint(MJstr4.Text,mvalue1)=False then
// begin
// Application.MessageBox('<27>׺<EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
// Exit;
// end;
// end;
{ if trim(MJMaoZ.Text)='' then
begin
MJMaoZ.Text:=floattostr(strtofloatdef(trim(MJQty3.Text),0)+strtofloatdef(trim(MJQty4.Text),0) );
end;
if trim(MJQty4.Text)='' then
begin
MJQty4.Text:=floattostr(strtofloatdef(trim(MJMaoZ.Text),0)-strtofloatdef(trim(MJQty3.Text),0) );
end;
if trim(MJQty3.Text)='' then
MJQty3.Text:=floattostr(strtofloatdef(trim(MJMaoZ.Text),0)-strtofloatdef(trim(MJQty4.Text),0) ); }
2025-09-19 16:22:04 +08:00
if Trim(FAPID) = '' then
Exit;
2025-01-21 15:30:43 +08:00
{ if FInt=4 then
begin
if CDS_MJID.IsEmpty=False then
begin
Application.MessageBox('<27>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB3A2><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>','<27><>ʾ',0);
Exit;
end;
end;
}
2025-09-19 16:22:04 +08:00
if trim(MJXH.text) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>', '<27><>ʾ');
2025-01-21 15:30:43 +08:00
exit;
end;
{ if (trim(MJMaoZ.Text)='') and (trim(MJQty4.Text)='') then
begin
Application.MessageBox('<27><><EFBFBD>أ<EFBFBD>ë<EFBFBD>ز<EFBFBD><D8B2>ܶ<EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
}
2025-09-19 16:22:04 +08:00
if trim(Label9.Caption) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Application.MessageBox('<27><><EFBFBD>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
Exit;
end;
2025-09-19 16:22:04 +08:00
if Trim(MJQty1.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if TryStrToFloat(MJQty1.Text, mvalue) = False then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Application.MessageBox(<><D4AD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
Exit;
end;
end;
2025-09-19 16:22:04 +08:00
if Trim(MJFK.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if TryStrToFloat(MJFK.Text, mvalue) = False then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
Exit;
end;
end;
2025-09-19 16:22:04 +08:00
if Trim(MJMaoZ.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if TryStrToFloat(MJMaoZ.Text, mvalue) = False then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
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;
2025-09-19 16:22:04 +08:00
if fRollType = '<27>޹<EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFB_MJJY where MainId=''' + trim(fmainId) + ''' and MJXH=' + MJXH.Text + '');
Open;
end;
if ADOCmd.RecordCount <> 0 then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
end;
2025-01-21 15:30:43 +08:00
// if PState=1 then
// begin
// // if Application.MessageBox('<27>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EBA3BF>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8>','<27><>ʾ',32+4)<>IDYES then Exit;
// end;
if SaveData() then
begin
//BtnStatus(False);
//MJFK.Text:='';
//MJSJKZ.Text:='';
2025-09-19 16:22:04 +08:00
MJLen.Text := '';
MJMaoZ.Text := '';
MJQty1.Text := '';
2025-01-21 15:30:43 +08:00
// MJQty2.Text:='';
//MJSJKZ.Text:='';
2025-09-19 16:22:04 +08:00
Label15.Caption := '';
2025-01-21 15:30:43 +08:00
//MJQty3.Text:='';
2025-09-19 16:22:04 +08:00
MJQty4.Text := '';
MJQty5.Text := '';
note.Text := '';
2025-01-21 15:30:43 +08:00
// Edit3.Text:='<27><>';
// Edit4.Text:='';
// Edit5.Text:='';
2025-09-19 16:22:04 +08:00
MJXH.Text := inttostr(strTointdef(trim(MJXH.Text), 0) + 1);
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
if PState = 2 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
apid.Text := FAPID;
2025-01-21 15:30:43 +08:00
Button3.Click;
end;
end
else
2025-09-19 16:22:04 +08:00
exit;
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
if Trim(Edit6.Text) = '<27><>' then
2025-01-21 15:30:43 +08:00
begin
//for i:=1 to StrToInt(ComboBox1.Text) do
//begin
2025-09-19 16:22:04 +08:00
PrtData(FFFMJID);
2025-01-21 15:30:43 +08:00
//end;
end;
2025-09-19 16:22:04 +08:00
Label16.Caption := '';
2025-01-21 15:30:43 +08:00
BTAdd.Click;
MJLen.SetFocus;
MJQty4.OnClick(MJQty4);
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.PrtData(FMJID: string);
2025-01-21 15:30:43 +08:00
var
2025-09-19 16:22:04 +08:00
fPrintFile: string;
Txt, fImagePath, Txt2, fImagePath2: string;
2025-01-21 15:30:43 +08:00
Moudle: THandle;
2025-09-19 16:22:04 +08:00
Makebar: TMakebar;
Mixtext: TMixtext;
2025-01-21 15:30:43 +08:00
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
2025-09-19 16:22:04 +08:00
sql.Add('exec P_Print_Roll ''' + Trim(FMJID) + ''' ');
// sql.Add('select A.MJID,A.mjstr3,QtyUnit=A.MJTypeOther,B.orderNo,B.customerNoName,B.LBName,B.MF as prtmf,B.KZ as prtkz ');
// sql.Add(',EngColor=(select max(Note) from KH_Zdy X where X.ZDYName=C.PRTColor and X.Type=''OrdColor'' ) ');
// sql.Add(',B.MPRTCF,B.CodeName,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)+'''');
2025-01-21 15:30:43 +08:00
Open;
end;
sleep(300);
try
2025-09-19 16:22:04 +08:00
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);
2025-01-21 15:30:43 +08:00
except
2025-09-19 16:22:04 +08:00
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
2025-01-21 15:30:43 +08:00
CDS_MJID.EnableControls;
exit;
end;
2025-09-19 16:22:04 +08:00
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt2 := Trim(ADOQueryPrint.fieldbyname('PRINTCode').AsString);
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\temp2.bmp';
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
if FileExists(fImagePath2) then
DeleteFile(fImagePath2);
Makebar(pchar(Txt2), Length(Txt2), 3, 3, 0, PChar(fImagePath2), 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
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('Slbname').AsString)
2025-01-21 15:30:43 +08:00
else
2025-09-19 16:22:04 +08:00
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ͨ<>ñ<EFBFBD>ǩ.rmf';
2025-01-21 15:30:43 +08:00
if FileExists(fPrintFile) then
begin
2025-09-19 16:22:04 +08:00
RMVariables['QRBARCODE'] := fImagePath;
RMVariables['QRBARCODE2'] := fImagePath2;
2025-01-21 15:30:43 +08:00
RM2.LoadFromFile(fPrintFile);
2025-09-19 16:22:04 +08:00
RM2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
2025-01-21 15:30:43 +08:00
// RM2.ShowReport;
RM2.PrintReport;
2025-09-19 16:22:04 +08:00
end
else
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
end;
end;
procedure TfrmMJManageNewFDNewSF.SavedataCK();
var
2025-09-19 16:22:04 +08:00
CRID: Integer;
MaxCkNo, MaxCkSubNo: string;
2025-01-21 15:30:43 +08:00
begin
//if Trim(Cds_Main.fieldbyname('SubType').AsString)='<27><><EFBFBD><EFBFBD>' then
//////////////////////////////////////////////////////////////<2F><><EFBFBD><EFBFBD><E6B5BD><EFBFBD><EFBFBD>Ʒ<EFBFBD>ֿ<EFBFBD>////////////////////////////////////////////////
2025-09-19 16:22:04 +08:00
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
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('KGQty').Value := StrToFloat(MJMaoZ.Text);
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
if Trim(MJLen.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('Qty').Value := StrToFloat(MJLen.Text);
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
FieldByName('QtyUnit').Value := Trim(Label9.Caption);
FieldByName('Filler').Value := Trim(DName);
FieldByName('FillTime').Value := SGetServerDateTime(ADOTmp);
if Trim(Edit3.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('CPType').Value := '<27><>Ʒ';
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
if Trim(Edit4.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('CPType').Value := '<27><>Ʒ';
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
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
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('KCKGQty').Value := StrToFloat(MJMaoZ.Text);
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
if Trim(MJLen.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('KCQty').Value := StrToFloat(MJLen.Text);
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
FieldByName('KCQtyUnit').Value := Trim(Label9.Caption);
Post;
end;
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.BtnStatus(BSInt: Boolean);
2025-01-21 15:30:43 +08:00
begin
// Tv2.OptionsSelection.CellSelect:=BSInt;
end;
2025-09-19 16:22:04 +08:00
2025-01-21 15:30:43 +08:00
procedure TfrmMJManageNewFDNewSF.Tv2CDQtyPropertiesEditValueChanged(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
mvalue: string;
2025-01-21 15:30:43 +08:00
begin
try
2025-09-19 16:22:04 +08:00
mvalue := TcxTextEdit(Sender).EditingText;
if Trim(mvalue) <> '' then
2025-01-21 15:30:43 +08:00
begin
CDS_MJCD.Edit;
2025-09-19 16:22:04 +08:00
CDS_MJCD.FieldByName('CDQty').Value := mvalue;
2025-01-21 15:30:43 +08:00
CDS_MJCD.Post;
2025-09-19 16:22:04 +08:00
end
else
2025-01-21 15:30:43 +08:00
begin
CDS_MJCD.Edit;
2025-09-19 16:22:04 +08:00
CDS_MJCD.FieldByName('CDQty').Value := 0;
2025-01-21 15:30:43 +08:00
CDS_MJCD.Post;
end;
CDS_MJCD.Edit;
2025-09-19 16:22:04 +08:00
CDS_MJCD.FieldByName('CDQtyS').Value := mvalue;
2025-01-21 15:30:43 +08:00
except
2025-09-19 16:22:04 +08:00
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>֣<EFBFBD>', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
end;
end;
procedure TfrmMJManageNewFDNewSF.SpeedButton1Click(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
fsj: string;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
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);
2025-01-21 15:30:43 +08:00
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
end;
procedure TfrmMJManageNewFDNewSF.SpeedButton12Click(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
fsj: string;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
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);
2025-01-21 15:30:43 +08:00
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
end;
procedure TfrmMJManageNewFDNewSF.SpeedButton13Click(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
i: Integer;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if Trim(Label24.Caption) = '' then
Exit;
if Label24.Visible = False then
Exit;
2025-01-21 15:30:43 +08:00
{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; }
2025-09-19 16:22:04 +08:00
if Trim(CDS_MJCD.fieldbyname('MJID').AsString) <> '' then
2025-01-21 15:30:43 +08:00
begin
BTAdd.Click;
end;
2025-09-19 16:22:04 +08:00
if Trim(Label15.Caption) <> '' then
2025-01-21 15:30:43 +08:00
begin
//MJFK.Text:='';
//MJSJKZ.Text:='';
2025-09-19 16:22:04 +08:00
MJLen.Text := '';
MJMaoZ.Text := '';
MJQty1.Text := '';
2025-01-21 15:30:43 +08:00
//MJSJKZ.Text:='';
2025-09-19 16:22:04 +08:00
Label15.Caption := '';
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
if Trim(FAPID) = '' then
Exit;
FCDName := Trim(TSpeedButton(Sender).Hint);
MovePanel1.Visible := True;
Label21.Caption := Trim(FCDName);
FInt := 11;
2025-01-21 15:30:43 +08:00
Edit1.SetFocus;
//CDQty.SetFocus;
2025-09-19 16:22:04 +08:00
Panel3.Visible := True;
PState := 1;
2025-01-21 15:30:43 +08:00
with Panel3 do
begin
2025-09-19 16:22:04 +08:00
for i := 0 to ControlCount - 1 do
2025-01-21 15:30:43 +08:00
begin
if Controls[i] is TSpeedButton then
begin
2025-09-19 16:22:04 +08:00
TSpeedButton(Controls[i]).Hint := Trim(Edit1.Name);
2025-01-21 15:30:43 +08:00
end;
end;
end;
end;
procedure TfrmMJManageNewFDNewSF.cxGridDBColumn2PropertiesChange(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
fsj: string;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
fsj := Trim(Order_MJ.fieldbyname('SubId').AsString);
2025-01-21 15:30:43 +08:00
Order_MJ.DisableControls;
with Order_MJ do
begin
First;
while not Eof do
begin
2025-09-19 16:22:04 +08:00
if Trim(Order_MJ.fieldbyname('SubId').AsString) <> fsj then
2025-01-21 15:30:43 +08:00
begin
Edit;
2025-09-19 16:22:04 +08:00
FieldByName('SSel').Value := False;
2025-01-21 15:30:43 +08:00
end;
Next;
end;
end;
Order_MJ.EnableControls;
2025-09-19 16:22:04 +08:00
Order_MJ.Locate('SubId', fsj, []);
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.Button1Click(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
mvalue: Double;
2025-01-21 15:30:43 +08:00
begin
{ if Trim(Edit1.Text)='' then
begin
Application.MessageBox(<>ò<EFBFBD><C3B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
exit;
end; }
2025-09-19 16:22:04 +08:00
if Trim(Edit1.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if Trim(Edit2.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if StrToFloat(Edit2.Text) < StrToFloat(Edit1.Text) then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Application.MessageBox('<27>õ<EFBFBD>λ<EFBFBD><CEBB>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
Exit;
end;
end;
end;
2025-09-19 16:22:04 +08:00
if CDQty.Text <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if TryStrToFloat(CDQty.Text, mvalue) = False then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
Exit;
end;
end;
with CDS_MJCD do
begin
Append;
2025-09-19 16:22:04 +08:00
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
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('CDQty').Value := StrToFloat(CDQty.Text);
end
else
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
FieldByName('CDQty').Value := 0;
2025-01-21 15:30:43 +08:00
end;
Post;
end;
2025-09-19 16:22:04 +08:00
Edit1.Text := '';
Edit2.Text := '';
CDQty.Text := '';
Edit8.Text := '';
MovePanel1.Visible := False;
Panel3.Visible := False;
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.Button4Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
Edit1.Text := '';
Edit2.Text := '';
CDQty.Text := '';
MovePanel1.Visible := False;
Panel3.Visible := False;
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.ToolButton1Click(Sender: TObject);
begin
InitJP();
end;
procedure TfrmMJManageNewFDNewSF.Button5Click(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
fPrintFile: string;
i: Integer;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if CDS_MJID.IsEmpty then
Exit;
2025-01-21 15:30:43 +08:00
PrtData(Trim(CDS_MJID.fieldbyname('MJID').AsString));
end;
procedure TfrmMJManageNewFDNewSF.SpeedButton49Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
Panel3.Visible := False;
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.APIDKeyPress(Sender: TObject; var Key: Char);
begin
2025-09-19 16:22:04 +08:00
if Key = #13 then
2025-01-21 15:30:43 +08:00
begin
Button3.Click;
{ with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select B.*,B.OrderNo OrderNOM,C.*,');
sql.Add('maxMJxh=isnull((select max(mjxh) from WFB_MJJY X where X.SubID=C.subID),0)');
sql.Add('from JYOrder_Sub C');
SQL.Add(' inner join JYOrder_Main B on C.MainId=B.MainId ');
sql.Add('where C.SubID='''+Trim(APID.Text)+'''');
Open;
end;
if ADOTmp.IsEmpty=False then
begin
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);
Label2.Visible:=true;
Label2.Caption:='<27><><EFBFBD>ͺ<EFBFBD>:'+Trim(ADOTmp.fieldbyname('PRTHX').AsString);
FAPID:=Trim(APID.Text);
FMainId:=Trim(ADOTmp.fieldbyname('MainId').AsString);
FSubId:=Trim(ADOTmp.fieldbyname('SubId').AsString);
AOrdDefNote1.Text:='<27><>װҪ<D7B0><D2AA>:'+#13
+Trim(ADOTmp.fieldbyname('MPRTBZNote').AsString)+#13
//+'<27><><EFBFBD><EFBFBD>:'+Trim(ADOTmp.fieldbyname('MPRTYaoFeng').AsString)+#13
//+'<27>̽<EFBFBD>:'+Trim(ADOTmp.fieldbyname('MPRTTangJin').AsString)+#13
//+'<27><><EFBFBD><EFBFBD>:'+Trim(ADOTmp.fieldbyname('MPRTKaiJian').AsString)+#13
// +'<27>ŷ<EFBFBD>:'+Trim(ADOTmp.fieldbyname('PRTMF').AsString)+#13
// +'<27><><EFBFBD><EFBFBD>:'+Trim(ADOTmp.fieldbyname('PRTKZ').AsString)+#13
+'<27><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>:'+#13
+Trim(ADOTmp.fieldbyname('MPRTSCTeBieNote').AsString);
//+'<27>ر<EFBFBD><D8B1><EFBFBD>ʾ:'+Trim(ADOTmp.fieldbyname('MPRTTeBieNote').AsString);
MJQty3.Text:=Trim(ADOTmp.fieldbyname('SPiZhong').AsString);
// if trim(adotmp.fieldbyname('OrderUnit').asstring)<>'' then
// Label9.Caption:=trim(adotmp.fieldbyname('OrderUnit').asstring);
if ADOTmp.FieldByName('PRTMF').AsFloat>0 then
MJFK.Text:=Trim(ADOTmp.fieldbyname('PRTMF').AsString);
if ADOTmp.FieldByName('PRTKZ').AsFloat>0 then
MJSJKZ.Text:=Trim(ADOTmp.fieldbyname('PRTKZ').AsString);
MJXH.Text:=inttostr(ADOTmp.fieldbyname('maxMJxh').AsInteger+1);
Edit3.Text:='<27><>';
Edit4.Text:='';
Edit5.Text:='';
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:='';
Exit;
end;
APID.Text:='';
BTAdd.Click; }
end;
end;
procedure TfrmMJManageNewFDNewSF.Edit1Click(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
i: Integer;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Panel3.Visible := True;
2025-01-21 15:30:43 +08:00
with Panel3 do
begin
2025-09-19 16:22:04 +08:00
for i := 0 to ControlCount - 1 do
2025-01-21 15:30:43 +08:00
begin
if Controls[i] is TSpeedButton then
begin
2025-09-19 16:22:04 +08:00
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
2025-01-21 15:30:43 +08:00
end;
end;
end;
end;
procedure TfrmMJManageNewFDNewSF.Edit2Change(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
mvalue: Double;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if Trim(Edit1.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if TryStrToFloat(Edit1.Text, mvalue) = False then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
Exit;
end;
2025-09-19 16:22:04 +08:00
end
else
2025-01-21 15:30:43 +08:00
begin
Exit;
end;
2025-09-19 16:22:04 +08:00
if Trim(Edit2.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if TryStrToFloat(Edit2.Text, mvalue) = False then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
Exit;
end;
2025-09-19 16:22:04 +08:00
end
else
2025-01-21 15:30:43 +08:00
begin
Exit;
end;
2025-09-19 16:22:04 +08:00
CDQty.Text := FloatToStr(StrToFloat(Edit2.Text) - StrToFloat(Edit1.Text));
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.Edit3Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
if Trim(Edit3.Text) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit3.Text := '<27><>';
Edit4.Text := '';
Edit5.Text := '';
end
else
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit3.Text := '';
2025-01-21 15:30:43 +08:00
// Edit4.Text:='<27><>';
2025-09-19 16:22:04 +08:00
Edit5.Text := '';
2025-01-21 15:30:43 +08:00
end;
end;
procedure TfrmMJManageNewFDNewSF.Edit4Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
if Trim(Edit4.Text) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit4.Text := '<27><>';
Edit3.Text := '';
Edit5.Text := '';
end
else
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit4.Text := '';
2025-01-21 15:30:43 +08:00
// Edit3.Text:='<27><>';
2025-09-19 16:22:04 +08:00
Edit5.Text := '';
2025-01-21 15:30:43 +08:00
end;
end;
procedure TfrmMJManageNewFDNewSF.Edit5Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
if Trim(Edit5.Text) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit5.Text := '<27><>';
Edit3.Text := '';
Edit4.Text := '';
end
else
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit5.Text := '';
2025-01-21 15:30:43 +08:00
// Edit3.Text:='<27><>';
2025-09-19 16:22:04 +08:00
Edit4.Text := '';
2025-01-21 15:30:43 +08:00
end;
end;
procedure TfrmMJManageNewFDNewSF.Edit6Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
if Trim(Edit6.Text) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit6.Text := '<27><>';
end
else
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit6.Text := '';
2025-01-21 15:30:43 +08:00
end;
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.MJstr3KeyPress(Sender: TObject; var Key: Char);
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if Key = #13 then
2025-01-21 15:30:43 +08:00
begin
BTPrint.Click;
end;
end;
procedure TfrmMJManageNewFDNewSF.MJQty3Exit(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 TfrmMJManageNewFDNewSF.MJMaoZExit(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(MJMaoZ.Text)<>'') then
begin
MJQty4.Text:=floattostr(strtofloatdef(trim(MJMaoZ.Text),0)-strtofloatdef(trim(MJQty3.Text),0) );
exit;
end;}
end;
procedure TfrmMJManageNewFDNewSF.Label9Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
if trim(Label9.Caption) = 'M' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Label9.Caption := 'Y';
Label19.Caption := 'Y';
Label20.Caption := 'Y';
Label7.Caption := 'Y';
2025-01-21 15:30:43 +08:00
end
else
begin
2025-09-19 16:22:04 +08:00
Label9.Caption := 'M';
Label19.Caption := 'M';
Label20.Caption := 'M';
Label7.Caption := 'M';
2025-01-21 15:30:43 +08:00
end;
end;
procedure TfrmMJManageNewFDNewSF.MJLenExit(Sender: TObject);
begin
// MJQty3.OnExit(self);
end;
procedure TfrmMJManageNewFDNewSF.Button2Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
RadioGroup1.ItemIndex := -1;
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.MJQty4Change(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
FReal: Double;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if Trim(MJQty4.Text) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
MJMaoZ.Text := '';
2025-01-21 15:30:43 +08:00
Exit;
end;
// MJQty4.Text:=JsXj(MJQty4.Text);
2025-09-19 16:22:04 +08:00
if TryStrToFloat(MJQty4.Text, FReal) = False then
Exit;
if Trim(MJQty3.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if TryStrToFloat(MJQty3.Text, FReal) = True then
MJMaoZ.Text := FloatToStr(StrToFloat(MJQty4.Text) + StrToFloat(MJQty3.Text));
end
else
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
MJMaoZ.Text := MJQty4.Text;
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
if (strtofloatdef(trim(kmxs.Text), 0) <> 0) and (strtofloatdef(trim(mjQty4.Text), 0) <> 0) then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
MJLen.Text := format('%.' + trim(fxsws) + 'f', [strtofloatdef(trim(mjQty4.Text), 0) * strtofloatdef(trim(kmxs.Text), 0)])
2025-01-21 15:30:43 +08:00
end;
2025-09-19 16:22:04 +08:00
MJQty5.Text := format('%.' + trim(fxsws) + 'f', [strtofloatdef(trim(mjQty4.Text), 0) * 2.2046]);
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.MJMaoZChange(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
FReal: Double;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if Trim(MJMaoZ.Text) = '' then
2025-01-21 15:30:43 +08:00
begin
//MJLen.Text:='';
2025-09-19 16:22:04 +08:00
MJQty4.Text := '';
2025-01-21 15:30:43 +08:00
Exit;
end;
2025-09-19 16:22:04 +08:00
if TryStrToFloat(MJMaoZ.Text, FReal) = False then
Exit;
if Trim(MJQty3.Text) <> '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if TryStrToFloat(MJQty3.Text, FReal) = False then
Exit;
MJQty4.Text := FloatToStr(StrToFloat(MJMaoZ.Text) - StrToFloat(MJQty3.Text));
end
else
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
MJQty4.Text := MJMaoZ.Text;
2025-01-21 15:30:43 +08:00
end;
end;
procedure TfrmMJManageNewFDNewSF.APIDClick(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
i: Integer;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Panel3.Visible := True;
2025-01-21 15:30:43 +08:00
with Panel3 do
begin
2025-09-19 16:22:04 +08:00
for i := 0 to ControlCount - 1 do
2025-01-21 15:30:43 +08:00
begin
if Controls[i] is TSpeedButton then
begin
2025-09-19 16:22:04 +08:00
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
2025-01-21 15:30:43 +08:00
end;
end;
end;
end;
procedure TfrmMJManageNewFDNewSF.Button3Click(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
FBaoID: string;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
fRollType := '';
2025-01-21 15:30:43 +08:00
with ADOTmp do
2025-09-19 16:22:04 +08:00
begin
Close;
sql.Clear;
sql.Add('select B.*,B.OrderNo OrderNoM,C.*, ');
sql.Add('maxMJxh=isnull((select max(mjxh) from WFB_MJJY X where X.SubID=C.subID),0),');
sql.Add('maxBaoNO=1+isnull((select max(cast(baoNO as int)) from WFB_MJJY X where X.subID=C.subID ),0)');
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) + '''');
2025-01-21 15:30:43 +08:00
// ShowMessage(SQL.Text);
2025-09-19 16:22:04 +08:00
Open;
end;
if ADOTmp.IsEmpty = False then
begin
fRollType := trim(ADOTmp.fieldbyname('Orddefstr15').AsString);
Label24.Visible := True;
Label24.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + Trim(ADOTmp.fieldbyname('OrderNoM').AsString);
Label38.Visible := True;
Label38.Caption := 'Ʒ<><C6B7>:' + Trim(ADOTmp.fieldbyname('CodeName').AsString);
Label25.Visible := True;
Label25.Caption := <><C9AB>:' + Trim(ADOTmp.fieldbyname('PRTCOLOR').AsString);
2025-01-21 15:30:43 +08:00
// Label2.Visible:=true;
// Label2.Caption:='<27><><EFBFBD>ͺ<EFBFBD>:'+Trim(ADOTmp.fieldbyname('PRTHX').AsString);
// FAPID:=Trim(APID.Text);
2025-09-19 16:22:04 +08:00
FAPID := Trim(ADOTmp.fieldbyname('SubId').AsString);
FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString);
FSubId := Trim(ADOTmp.fieldbyname('SubId').AsString);
AOrdDefNote1.Text := '<27><>װҪ<D7B0><D2AA>:' + #13 + Trim(ADOTmp.fieldbyname('MPRTBZNote').AsString) + #13 //+'<27><><EFBFBD><EFBFBD>:'+Trim(ADOTmp.fieldbyname('MPRTYaoFeng').AsString)+#13
2025-01-21 15:30:43 +08:00
//+'<27>̽<EFBFBD>:'+Trim(ADOTmp.fieldbyname('MPRTTangJin').AsString)+#13
//+'<27><><EFBFBD><EFBFBD>:'+Trim(ADOTmp.fieldbyname('MPRTKaiJian').AsString)+#13
// +'<27>ŷ<EFBFBD>:'+Trim(ADOTmp.fieldbyname('PRTMF').AsString)+#13
// +'<27><><EFBFBD><EFBFBD>:'+Trim(ADOTmp.fieldbyname('PRTKZ').AsString)+#13
2025-09-19 16:22:04 +08:00
+ '<27><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>:' + #13 + Trim(ADOTmp.fieldbyname('MPRTSCTeBieNote').AsString);
2025-01-21 15:30:43 +08:00
//+'<27>ر<EFBFBD><D8B1><EFBFBD>ʾ:'+Trim(ADOTmp.fieldbyname('MPRTTeBieNote').AsString);
2025-09-19 16:22:04 +08:00
MJQty3.Text := Trim(ADOTmp.fieldbyname('SPiZhong').AsString);
kmxs.Text := Trim(ADOTmp.fieldbyname('kmxs').AsString);
if ADOTmp.FieldByName('PRTMF').AsFloat > 0 then
MJFK.Text := Trim(ADOTmp.fieldbyname('PRTMF').AsString);
if ADOTmp.FieldByName('PRTKZ').AsFloat > 0 then
MJSJKZ.Text := Trim(ADOTmp.fieldbyname('PRTKZ').AsString);
MJXH.Text := inttostr(ADOTmp.fieldbyname('maxMJxh').AsInteger + 1);
fxsws := Trim(ADOTmp.fieldbyname('xsws').AsString);
fxsws1 := Trim(ADOTmp.fieldbyname('xsws1').AsString);
baoNO.Text := Trim(ADOTmp.fieldbyname('maxBaoNO').AsString);
if GetLSNo(ADOCmd, FBaoID, 'BI', 'WFB_MJJY', 3, 1) = False then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
// ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
Exit;
end;
2025-09-19 16:22:04 +08:00
baoid.Text := FBaoID;
// if trim(adotmp.fieldbyname('OrderUnit').asstring)<>'' then
// Label9.Caption:=trim(adotmp.fieldbyname('OrderUnit').asstring);
Edit3.Text := '<27><>';
Edit4.Text := '';
Edit5.Text := '';
MJStr4.Text := Trim(ADOTmp.fieldbyname('gangno').AsString);
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;
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
APID.Text := '';
BTAdd.Click;
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.Edit7Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
if Trim(Edit7.Text) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit7.Text := '<27><>';
if not IsCommOpen then
OpenCom(JCYDLL);
IsJsMessage := true;
2025-01-21 15:30:43 +08:00
end
else
begin
2025-09-19 16:22:04 +08:00
Edit7.Text := '';
IsJsMessage := true;
2025-01-21 15:30:43 +08:00
end;
end;
procedure TfrmMJManageNewFDNewSF.Button6Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
frmClothHCList := TfrmClothHCList.create(self);
2025-01-21 15:30:43 +08:00
with frmClothHCList do
begin
2025-09-19 16:22:04 +08:00
fType := '10';
if showmodal = 1 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
APID.Text := trim(Order_Main.fieldbyname('Subid').asstring);
2025-01-21 15:30:43 +08:00
Button3.Click;
end;
free;
end;
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.MJQty4KeyPress(Sender: TObject; var Key: Char);
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if Key = #13 then
2025-01-21 15:30:43 +08:00
begin
BTPrint.Click;
end;
end;
procedure TfrmMJManageNewFDNewSF.MJXHClick(Sender: TObject);
var
2025-09-19 16:22:04 +08:00
i: Integer;
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Panel3.Visible := True;
2025-01-21 15:30:43 +08:00
with Panel3 do
begin
2025-09-19 16:22:04 +08:00
for i := 0 to ControlCount - 1 do
2025-01-21 15:30:43 +08:00
begin
if Controls[i] is TSpeedButton then
begin
2025-09-19 16:22:04 +08:00
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
2025-01-21 15:30:43 +08:00
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.MJQty5Change(Sender: TObject);
begin
// MJQty2.Text:=JsXj(MJQty2.Text);
end;
2025-09-19 16:22:04 +08:00
procedure TfrmMJManageNewFDNewSF.MJQty4KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Tedit(Sender).SelStart := length(Tedit(Sender).Text);
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.MJStr4Exit(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
if Pstate = 1 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if fRollType = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
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) + ''' ');
2025-01-21 15:30:43 +08:00
// sql.add('and X.MJStr4='+quotedstr(trim(MJstr4.text)));
2025-09-19 16:22:04 +08:00
Open;
MJXH.Text := Trim(fieldbyname('maxRoll').AsString);
end;
2025-01-21 15:30:43 +08:00
end
2025-09-19 16:22:04 +08:00
else if fRollType = '<27><><EFBFBD>׺<EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
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;
2025-01-21 15:30:43 +08:00
end
2025-09-19 16:22:04 +08:00
else if fRollType = '<27>޹<EFBFBD><DEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
end
2025-01-21 15:30:43 +08:00
else
begin
2025-09-19 16:22:04 +08:00
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;
2025-01-21 15:30:43 +08:00
end;
end;
end;
procedure TfrmMJManageNewFDNewSF.ToolButton2Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
if CDS_MJID.IsEmpty then
exit;
if CDS_MJCD.IsEmpty = False then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
if Trim(CDS_MJCD.fieldbyname('MJID').AsString) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
Exit;
end;
end;
2025-09-19 16:22:04 +08:00
FInt := 4;
PState := 0;
2025-01-21 15:30:43 +08:00
InitCDGrid();
with ADOTmp do
begin
close;
sql.Clear;
2025-09-19 16:22:04 +08:00
sql.Add('select * from WFB_MJJY where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + '''');
2025-01-21 15:30:43 +08:00
Open;
end;
2025-09-19 16:22:04 +08:00
MJFK.Text := Trim(ADOTmp.fieldbyname('MJFK').AsString);
MJSJKZ.Text := Trim(ADOTmp.fieldbyname('MJSJKZ').AsString);
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
MJQty1.Text := Trim(ADOTmp.fieldbyname('MJQty1').AsString);
2025-01-21 15:30:43 +08:00
// MJQty2.Text:=Trim(ADOTmp.fieldbyname('MJQty2').AsString);
2025-09-19 16:22:04 +08:00
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);
if Trim(ADOTmp.fieldbyname('MJType').AsString) = '<27><>Ʒ' then
begin
Edit3.Text := '<27><>';
Edit4.Text := '';
Edit5.Text := '';
end
else if Trim(ADOTmp.fieldbyname('MJType').AsString) = '<27><>Ʒ' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit4.Text := '<27><>';
Edit3.Text := '';
Edit5.Text := '';
end
else if Trim(ADOTmp.fieldbyname('MJType').AsString) = '<27><><EFBFBD><EFBFBD>' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit4.Text := '';
Edit3.Text := '';
Edit5.Text := '<27><>';
end
else if Trim(ADOTmp.fieldbyname('MJType').AsString) = '<27><><EFBFBD><EFBFBD>' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit4.Text := '';
Edit3.Text := '';
Edit5.Text := '';
2025-01-21 15:30:43 +08:00
end;
BtnStatus(False);
2025-09-19 16:22:04 +08:00
Label16.Caption := '';
PState := 2;
2025-01-21 15:30:43 +08:00
end;
procedure TfrmMJManageNewFDNewSF.Edit9Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
if Trim(Edit9.Text) = '' then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Edit9.Text := '<27><>';
2025-01-21 15:30:43 +08:00
end
else
begin
2025-09-19 16:22:04 +08:00
Edit9.Text := '';
2025-01-21 15:30:43 +08:00
end;
end;
procedure TfrmMJManageNewFDNewSF.ToolButton3Click(Sender: TObject);
begin
2025-09-19 16:22:04 +08:00
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;
2025-01-21 15:30:43 +08:00
with ADOCmd do
begin
Close;
sql.Clear;
2025-09-19 16:22:04 +08:00
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) + ''' ');
2025-01-21 15:30:43 +08:00
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
2025-09-19 16:22:04 +08:00
sql.Add(' ' + quotedstr(trim(DName)));
2025-01-21 15:30:43 +08:00
sql.Add(',getdate() ');
2025-09-19 16:22:04 +08:00
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) + ' <20><>ɫ:' + trim(fsubID))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
2025-01-21 15:30:43 +08:00
sql.Add(')');
execsql;
end;
InitCDGridID();
end;
procedure TfrmMJManageNewFDNewSF.Button7Click(Sender: TObject);
2025-09-19 16:22:04 +08:00
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
FBaoID: string;
i: Integer;
begin
if CDS_MJID.IsEmpty then
exit;
2025-01-21 15:30:43 +08:00
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('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(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');
2025-09-19 16:22:04 +08:00
SQL.Add('where A.BaoID=''' + Trim(CDS_MJID.fieldbyname('baoID').AsString) + '''');
2025-01-21 15:30:43 +08:00
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;
2025-09-19 16:22:04 +08:00
if ADOQueryPrint.RecordCount > 1 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>!', '<27><>ʾ', 0);
2025-01-21 15:30:43 +08:00
Exit;
end;
2025-09-19 16:22:04 +08:00
if ADOQueryPrint.RecordCount < 1 then
2025-01-21 15:30:43 +08:00
begin
2025-09-19 16:22:04 +08:00
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);
2025-01-21 15:30:43 +08:00
Exit;
end;
try
2025-09-19 16:22:04 +08:00
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);
2025-01-21 15:30:43 +08:00
except
2025-09-19 16:22:04 +08:00
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
2025-01-21 15:30:43 +08:00
exit;
end;
2025-09-19 16:22:04 +08:00
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)));
sql.Add('and subID=' + quotedstr(trim(fsubID)));
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
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('NLbName').AsString) + '.rmf'
2025-01-21 15:30:43 +08:00
else
2025-09-19 16:22:04 +08:00
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;
2025-01-21 15:30:43 +08:00
2025-09-19 16:22:04 +08:00
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
RM2.LoadFromFile(fPrintFile);
RM2.DefaultCopies := 1;
2025-01-21 15:30:43 +08:00
//RM2.ShowReport;
2025-09-19 16:22:04 +08:00
RM2.printReport;
end;
2025-01-21 15:30:43 +08:00
end;
end.
2025-09-19 16:22:04 +08:00