1389 lines
39 KiB
ObjectPascal
1389 lines
39 KiB
ObjectPascal
|
|
unit U_MachRollMarket;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
|||
|
|
System.Classes, Vcl.Graphics, mmsystem, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
|
|||
|
|
cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxClasses,
|
|||
|
|
dxLayoutContainer, dxLayoutControl, dxLayoutcxEditAdapters, cxContainer,
|
|||
|
|
cxEdit, Vcl.StdCtrls, cxTextEdit, Vcl.ExtCtrls, dxLayoutControlAdapters,
|
|||
|
|
U_BaseList, Data.DB, Data.Win.ADODB, Vcl.Buttons, Vcl.ComCtrls, Vcl.ToolWin,
|
|||
|
|
cxImage, cxDBEdit, cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage,
|
|||
|
|
cxNavigator, dxDateRanges, dxScrollbarAnnotations, cxDBData, dxBarBuiltInMenu,
|
|||
|
|
cxPC, cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
|
cxGridCustomView, cxGrid, cxMemo, cxRichEdit, U_frameBads, Datasnap.DBClient,
|
|||
|
|
RM_Common, RM_Class, RM_GridReport, cxCheckBox, cxMaskEdit, cxDropDownEdit,
|
|||
|
|
Vcl.Menus, cxButtonEdit, RM_Dataset, cxGeometry, dxFramedControl, dxPanel,
|
|||
|
|
U_KeyBoard, cxGroupBox, cxGridCustomPopupMenu, cxGridPopupMenu, MovePanel,
|
|||
|
|
RM_RichEdit, cxProgressBar, cxCurrencyEdit, dxSkinsCore, frxBarcode, frxRich,
|
|||
|
|
frxOLE, frxTableObject, frxExportXLSX, frxClass, frxExportBaseDialog,
|
|||
|
|
frxExportPPTX, frxDBSet, dxSkinWXI, dxSkinsDefaultPainters;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmMachRollMarket = class(TfrmBaseList)
|
|||
|
|
Panel_right: TPanel;
|
|||
|
|
cds_params: TClientDataSet;
|
|||
|
|
cds_paramsdabao: TStringField;
|
|||
|
|
cds_paramspackRolls: TIntegerField;
|
|||
|
|
cds_paramsrollNoMake: TStringField;
|
|||
|
|
cds_paramsMinWeight: TIntegerField;
|
|||
|
|
cds_paramsMaxWeight: TIntegerField;
|
|||
|
|
cds_paramslblLenUnit: TStringField;
|
|||
|
|
cds_paramsMinLen: TIntegerField;
|
|||
|
|
cds_paramsmaxLen: TIntegerField;
|
|||
|
|
cds_paramsweightRule: TIntegerField;
|
|||
|
|
cds_paramschen: TStringField;
|
|||
|
|
cds_paramsmabiao: TStringField;
|
|||
|
|
cds_paramsmbunit: TStringField;
|
|||
|
|
cds_paramsmplace: TIntegerField;
|
|||
|
|
cds_paramsyplace: TIntegerField;
|
|||
|
|
cds_paramskgplace: TIntegerField;
|
|||
|
|
cds_paramslabNumber: TIntegerField;
|
|||
|
|
CDS_2: TClientDataSet;
|
|||
|
|
DS_2: TDataSource;
|
|||
|
|
cds_1: TClientDataSet;
|
|||
|
|
cds_3: TClientDataSet;
|
|||
|
|
ds_3: TDataSource;
|
|||
|
|
ds_1: TDataSource;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
cds_paramsoutPage: TStringField;
|
|||
|
|
ADOQueryPrint: TADOQuery;
|
|||
|
|
cds_paramsEndPieceNo: TIntegerField;
|
|||
|
|
cds_paramsBeginPieceNo: TIntegerField;
|
|||
|
|
cds_paramsFixedLength: TIntegerField;
|
|||
|
|
cds_paramspacknoMake: TStringField;
|
|||
|
|
cds_paramspieceOrder: TBooleanField;
|
|||
|
|
cds_paramsLabVolume: TStringField;
|
|||
|
|
cds_paramsLabPackage: TStringField;
|
|||
|
|
cxGroupBox_keys: TcxGroupBox;
|
|||
|
|
FrameKeyBoard1: TFrameKeyBoard;
|
|||
|
|
cds_paramsAddwetPresent: TFloatField;
|
|||
|
|
cds_paramsAddLenPresent: TFloatField;
|
|||
|
|
GPM_3: TcxGridPopupMenu;
|
|||
|
|
MovePanel1: TMovePanel;
|
|||
|
|
ADOQueryImage: TADOQuery;
|
|||
|
|
DS_IMAGE: TDataSource;
|
|||
|
|
cds_paramspackPrintPreview: TBooleanField;
|
|||
|
|
cds_paramspacklabNumber: TIntegerField;
|
|||
|
|
cds_paramspackPostAction: TStringField;
|
|||
|
|
ADO_CJ: TADOQuery;
|
|||
|
|
fRMDB_1: TfrxDBDataset;
|
|||
|
|
frxReport1: TfrxReport;
|
|||
|
|
frxPPTXExport1: TfrxPPTXExport;
|
|||
|
|
frxXLSXExport1: TfrxXLSXExport;
|
|||
|
|
frxReportTableObject1: TfrxReportTableObject;
|
|||
|
|
frxOLEObject1: TfrxOLEObject;
|
|||
|
|
frxRichObject1: TfrxRichObject;
|
|||
|
|
frxBarCodeObject1: TfrxBarCodeObject;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
TV2: TcxGridDBTableView;
|
|||
|
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
|
TV2Column1: TcxGridDBColumn;
|
|||
|
|
TV2Column2: TcxGridDBColumn;
|
|||
|
|
v1PRTColor: TcxGridDBColumn;
|
|||
|
|
v1PRTOrderQty: TcxGridDBColumn;
|
|||
|
|
v1OrderUnit: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn7: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
TV2Column3: TcxGridDBColumn;
|
|||
|
|
TV2Column4: TcxGridDBColumn;
|
|||
|
|
ADO_2: TADOQuery;
|
|||
|
|
TV2Column5: TcxGridDBColumn;
|
|||
|
|
TV2Column7: TcxGridDBColumn;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
edtScan: TcxTextEdit;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
OrderNo: TcxTextEdit;
|
|||
|
|
ColorNo: TcxTextEdit;
|
|||
|
|
FtyPCId: TcxTextEdit;
|
|||
|
|
Qty: TcxTextEdit;
|
|||
|
|
BCIOID: TcxTextEdit;
|
|||
|
|
Color: TcxTextEdit;
|
|||
|
|
CodeName: TcxTextEdit;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
InputLen: TcxTextEdit;
|
|||
|
|
lblLenUnit: TLabel;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
InputWeight: TcxTextEdit;
|
|||
|
|
Tare: TcxTextEdit;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
BTPrint: TButton;
|
|||
|
|
Coefficient: TcxTextEdit;
|
|||
|
|
lblRuleConversion: TcxComboBox;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
AOrdDefNote1: TcxRichEdit;
|
|||
|
|
packnote: TcxMemo;
|
|||
|
|
unitPieces: TcxTextEdit;
|
|||
|
|
presentWeight: TcxTextEdit;
|
|||
|
|
presentLen: TcxTextEdit;
|
|||
|
|
bt_printmd: TButton;
|
|||
|
|
addWet: TcxTextEdit;
|
|||
|
|
addLen: TcxTextEdit;
|
|||
|
|
C_GramWeight: TcxTextEdit;
|
|||
|
|
C_Width: TcxTextEdit;
|
|||
|
|
customStrField2: TcxTextEdit;
|
|||
|
|
customStrField1: TcxTextEdit;
|
|||
|
|
C_StyleNo: TcxTextEdit;
|
|||
|
|
RuleYardstick: TcxTextEdit;
|
|||
|
|
C_Pattern: TcxTextEdit;
|
|||
|
|
OutPutWeight: TcxTextEdit;
|
|||
|
|
cxDBImage1: TcxDBImage;
|
|||
|
|
Button1: TButton;
|
|||
|
|
TV2Column8: TcxGridDBColumn;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
cxGrid3: TcxGrid;
|
|||
|
|
Tv3: TcxGridDBTableView;
|
|||
|
|
v3PieceNo: TcxGridDBColumn;
|
|||
|
|
Tv3Yardage: TcxGridDBColumn;
|
|||
|
|
Tv3Meter: TcxGridDBColumn;
|
|||
|
|
v3NetWeight: TcxGridDBColumn;
|
|||
|
|
v3GrossWeight: TcxGridDBColumn;
|
|||
|
|
Tv3Grade: TcxGridDBColumn;
|
|||
|
|
tv3CIID: TcxGridDBColumn;
|
|||
|
|
cxGridLevel2: TcxGridLevel;
|
|||
|
|
ToolBar2: TToolBar;
|
|||
|
|
ToolButton3: TToolButton;
|
|||
|
|
Trolldel: TToolButton;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
Tlog: TToolButton;
|
|||
|
|
ToolButton8: TToolButton;
|
|||
|
|
ToolButton2: TButton;
|
|||
|
|
Tv3Column1: TcxGridDBColumn;
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure edtScanDblClick(Sender: TObject);
|
|||
|
|
procedure edtScanKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure ToolButton8Click(Sender: TObject);
|
|||
|
|
procedure edtScanEnter(Sender: TObject);
|
|||
|
|
procedure BTPrintClick(Sender: TObject);
|
|||
|
|
procedure TrolldelClick(Sender: TObject);
|
|||
|
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
|
procedure Tv3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
procedure InputLenKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure InputLenPropertiesChange(Sender: TObject);
|
|||
|
|
procedure FrameKeyBoard1SpeedButton_ycClick(Sender: TObject);
|
|||
|
|
procedure dxLayoutItem1CaptionClick(Sender: TObject);
|
|||
|
|
procedure lblRuleConversionPropertiesChange(Sender: TObject);
|
|||
|
|
procedure bt_printmdClick(Sender: TObject);
|
|||
|
|
procedure dxLayoutControl_packDblClick(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure FrameKeyBoard1SpeedButton1Click(Sender: TObject);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure Button1Click(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
FCIID, FCIFName, FWorkshop: string;
|
|||
|
|
FBCIOID, FC_Code, FC_ColorNo, FQtyUnit, FLenUnit, FTMSId: string;
|
|||
|
|
Faddwet, faddlen: double;
|
|||
|
|
FFtyPCId, FGangNo, FRulePieceNo, FCDUnit: string;
|
|||
|
|
FPieceNo: Integer;
|
|||
|
|
fIsPack: string;
|
|||
|
|
fIsCommopen: Boolean;
|
|||
|
|
FPacketCIID: string;
|
|||
|
|
fLabPackage, fLabVolume: string;
|
|||
|
|
FPacketCount: Integer;
|
|||
|
|
fAddwetVirtual: double;
|
|||
|
|
fAddLenVirtual: double;
|
|||
|
|
fTareType: string;
|
|||
|
|
funitPiecesStr: string; //ƴƥ
|
|||
|
|
procedure setFocusCtrol(controlName: string);
|
|||
|
|
procedure QuantityConversion();
|
|||
|
|
procedure ClearGlobal();
|
|||
|
|
procedure InitPlan(MSubID: string);
|
|||
|
|
procedure SetUnit(MUnit: string);
|
|||
|
|
procedure SetDdetails();
|
|||
|
|
procedure SetINIFile();
|
|||
|
|
procedure GetINIFile();
|
|||
|
|
procedure InitJYGrid();
|
|||
|
|
procedure InitGrid2();
|
|||
|
|
procedure OpenCom(DllName: string);
|
|||
|
|
procedure CloseCom(DllName: string);
|
|||
|
|
function SaveData(): Boolean;
|
|||
|
|
procedure PrtData(MCIID: string; againPring: Boolean = false);
|
|||
|
|
procedure BadSpeedButtonClick(Sender: TObject);
|
|||
|
|
procedure setFormCtrol();
|
|||
|
|
procedure On1201(var Message: Tmessage); message 1201; // <20><><EFBFBD>ӳ<EFBFBD>
|
|||
|
|
procedure On1301(var Message: Tmessage); message 1301; // <20><><EFBFBD><EFBFBD>
|
|||
|
|
function CheckData(CKType: string): Boolean;
|
|||
|
|
function deletePack(packId: string): boolean;
|
|||
|
|
type
|
|||
|
|
|
|||
|
|
public
|
|||
|
|
fmanage: string;
|
|||
|
|
fFlileFlag: string;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmMachRollMarket: TfrmMachRollMarket;
|
|||
|
|
newh, newh1: hwnd;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_ControlData, U_ParamSet, U_RTFun, U_globalVar,
|
|||
|
|
U_FormLayOutDesign, U_ZDYHelp, U_iniParam, U_ProductListHelp, U_SysLogList,
|
|||
|
|
U_ProgressUpdate, U_LabelPrint, U_TradeClothTotalOutSel;
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.InitGrid2();
|
|||
|
|
var
|
|||
|
|
SqlStr: string;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
SqlStr := ' exec P_Trade_Market_WaitOut_Market ';
|
|||
|
|
SqlStr := SqlStr + ' @TMSId =' + quotedstr(trim(FTMSId));
|
|||
|
|
|
|||
|
|
InitCDSData(ADO_2, CDS_2, Tv2, SqlStr, '', '');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmMachRollMarket.CheckData(CKType: string): Boolean;
|
|||
|
|
var
|
|||
|
|
mvalue: double;
|
|||
|
|
mCurPieceNo: Integer;
|
|||
|
|
begin
|
|||
|
|
Result := false;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
if trim(FBCIOID) = '' then
|
|||
|
|
raise Exception.create('<27><>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF><EFBFBD>');
|
|||
|
|
|
|||
|
|
if trim(CKType) = '<27>ύ' then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if trim(lblLenUnit.Caption) = '' then
|
|||
|
|
raise Exception.create('<27><><EFBFBD>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
|||
|
|
|
|||
|
|
if trim(InputWeight.Text) <> '' then
|
|||
|
|
begin
|
|||
|
|
if TryStrToFloat(InputWeight.Text, mvalue) = false then
|
|||
|
|
raise Exception.create('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
|
|||
|
|
if strtofloatdef(trim(InputWeight.Text), 0) < cds_params.fieldbyName('minWeight').AsInteger then
|
|||
|
|
raise Exception.create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>' + cds_params.fieldbyName('minWeight').AsString + '!');
|
|||
|
|
if strtofloatdef(trim(InputWeight.Text), 0) > cds_params.fieldbyName('maxWeight').AsInteger then
|
|||
|
|
raise Exception.create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>' + cds_params.fieldbyName('maxWeight').AsString + '!');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if trim(InputLen.Text) <> '' then
|
|||
|
|
begin
|
|||
|
|
if TryStrToFloat(InputLen.Text, mvalue) = false then
|
|||
|
|
raise Exception.create('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
|
|||
|
|
if strtofloatdef(trim(InputLen.Text), 0) < cds_params.fieldbyName('minLen').AsInteger then
|
|||
|
|
raise Exception.create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>С<EFBFBD><D0A1>' + cds_params.fieldbyName('minLen').AsString + '<27><>!');
|
|||
|
|
if strtofloatdef(trim(InputLen.Text), 0) > cds_params.fieldbyName('maxLen').AsInteger then
|
|||
|
|
raise Exception.create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2>ܴ<EFBFBD><DCB4><EFBFBD>' + cds_params.fieldbyName('maxLen').AsString + '<27><>!');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if FQtyUnit = 'Kg' then
|
|||
|
|
begin
|
|||
|
|
if (strtofloatdef(trim(InputWeight.Text), 0) = 0) then
|
|||
|
|
raise Exception.create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0!!');
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
if (strtofloatdef(trim(InputLen.Text), 0) = 0) then
|
|||
|
|
raise Exception.create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ0!!');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
Result := true;
|
|||
|
|
except
|
|||
|
|
Application.MessageBox(pchar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.BTPrintClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile, MPacketId: string;
|
|||
|
|
mvalue: double;
|
|||
|
|
i: Integer;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
BTPrint.Enabled := false;
|
|||
|
|
|
|||
|
|
edtScan.SetFocus;
|
|||
|
|
|
|||
|
|
if CheckData('<27>ύ') = false then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
if SaveData() then
|
|||
|
|
begin
|
|||
|
|
InputLen.Text := '';
|
|||
|
|
presentLen.Text := '';
|
|||
|
|
funitPiecesStr := '';
|
|||
|
|
presentWeight.Text := '';
|
|||
|
|
|
|||
|
|
if fileexists(ExtractFilePath(Application.ExeName) + '<27><>ȷ.wav') then
|
|||
|
|
playSound(pwidechar('<27><>ȷ.wav'), 0, SND_FILENAME or SND_ASYNC);
|
|||
|
|
|
|||
|
|
InputWeight.Text := '';
|
|||
|
|
|
|||
|
|
if trim(cds_params.fieldbyName('outPage').AsString) = '<27><>' then
|
|||
|
|
begin
|
|||
|
|
PrtData(FCIID);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
InputLen.SetFocus;
|
|||
|
|
setFocusCtrol(InputLen.Name);
|
|||
|
|
InitJYGrid();
|
|||
|
|
InitGrid2();
|
|||
|
|
FCIID := '';
|
|||
|
|
finally
|
|||
|
|
BTPrint.Enabled := true;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.bt_printmdClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
WSql: string;
|
|||
|
|
begin
|
|||
|
|
if cds_3.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
WSql := '';
|
|||
|
|
cds_3.DisableControls;
|
|||
|
|
with cds_3 do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if WSql <> '' then
|
|||
|
|
begin
|
|||
|
|
WSql := WSql + ',' + Trim(cds_3.fieldbyname('CIID').AsString);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
WSql := Trim(cds_3.fieldbyname('CIID').AsString);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
cds_3.EnableControls;
|
|||
|
|
// try
|
|||
|
|
// frmMdPrint := TfrmMdPrint.Create(Application);
|
|||
|
|
// with frmMdPrint do
|
|||
|
|
// begin
|
|||
|
|
// FLMType := '<27><><EFBFBD><EFBFBD><EFBFBD>뵥';
|
|||
|
|
// FFiltration1 := WSql;
|
|||
|
|
// FFiltration2 := WSql;
|
|||
|
|
// if ShowModal = 1 then
|
|||
|
|
// begin
|
|||
|
|
//// Self.InitGrid();
|
|||
|
|
// end;
|
|||
|
|
// end;
|
|||
|
|
// finally
|
|||
|
|
// frmMdPrint.Free;
|
|||
|
|
// end;
|
|||
|
|
try
|
|||
|
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
|
with frmLabelPrint do
|
|||
|
|
begin
|
|||
|
|
FLMType := '<27><><EFBFBD><EFBFBD><EFBFBD>뵥';
|
|||
|
|
FFiltration1 := WSql;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// Self.InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmLabelPrint.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.Button1Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile, MPacketId, MTMSId: string;
|
|||
|
|
mvalue: double;
|
|||
|
|
i: Integer;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
BTPrint.Enabled := false;
|
|||
|
|
MTMSId := Trim(SelTVKey(Tv2, ['TMSId'])[0]);
|
|||
|
|
edtScan.SetFocus;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
ADOQueryBaseCmd.Connection.BeginTrans;
|
|||
|
|
|
|||
|
|
if trim(FBCIOID) = '' then
|
|||
|
|
raise Exception.create('<27><>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF><EFBFBD>');
|
|||
|
|
with ADOQueryBaseCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
|
|||
|
|
Sql.Add('exec P_BS_Cloth_Out_DistributionAll ');
|
|||
|
|
Sql.Add(' @StkID=' + quotedstr(Trim(FBCIOID)));
|
|||
|
|
Sql.Add(' ,@TMSId =' + quotedstr(MTMSId));
|
|||
|
|
Sql.Add(' ,@Dcode=' + quotedstr(Trim(Dcode)));
|
|||
|
|
Sql.Add(' ,@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
// showmessage(sql.Text);
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ADOQueryBaseCmd.fieldbyName('intReturn').AsInteger = -1 then
|
|||
|
|
begin
|
|||
|
|
raise Exception.create(pchar(trim(ADOQueryBaseCmd.fieldbyName('ShowMsg').AsString)));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
FCIID := trim(trim(ADOQueryBaseCmd.fieldbyName('MaxIOID2').AsString));
|
|||
|
|
|
|||
|
|
ADOQueryBaseCmd.Connection.CommitTrans;
|
|||
|
|
TradeMarketProgressUpdate(ADOQueryBaseCmd, MTMSId);
|
|||
|
|
except
|
|||
|
|
ADOQueryBaseCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox(pchar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
InputLen.SetFocus;
|
|||
|
|
setFocusCtrol(InputLen.Name);
|
|||
|
|
InitJYGrid();
|
|||
|
|
InitGrid2();
|
|||
|
|
FCIID := '';
|
|||
|
|
finally
|
|||
|
|
BTPrint.Enabled := true;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if fIsCommopen then
|
|||
|
|
begin
|
|||
|
|
CloseCom(DZCDYDllName);
|
|||
|
|
CloseCom(MBDYDllName);
|
|||
|
|
end;
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
fIsCommopen := false;
|
|||
|
|
cds_params.Close;
|
|||
|
|
cds_params.CreateDataSet;
|
|||
|
|
Panel_right.Align := alClient;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
frmMachRollMarket := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.FormShow(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
i: Integer;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
gIsCanDesign := gIsCanDesign;
|
|||
|
|
gGridNativeSet := true;
|
|||
|
|
|
|||
|
|
ReadCxGrid(trim(Self.Caption) + 'Tv3', Tv3, gDllFileCaption);
|
|||
|
|
|
|||
|
|
if IsINIFile() then
|
|||
|
|
ReadINIFile()
|
|||
|
|
else
|
|||
|
|
WriteINIFile;
|
|||
|
|
|
|||
|
|
GetINIFile();
|
|||
|
|
setFormCtrol();
|
|||
|
|
if trim(fmanage) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
if trim(DZCDYDllName) <> '' then
|
|||
|
|
OpenCom(DZCDYDllName);
|
|||
|
|
if trim(MBDYDllName) <> '' then
|
|||
|
|
OpenCom(MBDYDllName);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
if trim(fCanInputFs) = '1' then
|
|||
|
|
begin
|
|||
|
|
// cxGroupBox_keys.ClientHeight := round(cxGrid3.ClientHeight * 0.6);
|
|||
|
|
frameKeyBoard1.SpeedButton10.Visible := true;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
// cxGroupBox_keys.ClientHeight := round(cxGrid3.ClientHeight * 0.55);
|
|||
|
|
frameKeyBoard1.SpeedButton10.Visible := false;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.FrameKeyBoard1SpeedButton1Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj: string;
|
|||
|
|
mComponent: TComponent;
|
|||
|
|
mkey: Char;
|
|||
|
|
begin
|
|||
|
|
fsj := trim(TSpeedButton(Sender).Hint);
|
|||
|
|
if trim(fsj) = '' then
|
|||
|
|
exit;
|
|||
|
|
mComponent := FindComponent(trim(TSpeedButton(Sender).Hint));
|
|||
|
|
|
|||
|
|
if mComponent = nil then
|
|||
|
|
exit;
|
|||
|
|
if TcxTextEdit(mComponent).Name = 'KuangHao' then
|
|||
|
|
exit;
|
|||
|
|
if (TcxTextEdit(mComponent).Name = 'edtScan') and (trim(TSpeedButton(Sender).Caption) = '<27>س<EFBFBD>') then
|
|||
|
|
begin
|
|||
|
|
mkey := #13;
|
|||
|
|
edtScanKeyPress(edtScan, mkey);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
fsj := trim(TcxTextEdit(mComponent).Text);
|
|||
|
|
if mComponent is TcxCurrencyEdit then
|
|||
|
|
begin
|
|||
|
|
TcxCurrencyEdit(mComponent).text := fsj + trim(TSpeedButton(Sender).Caption);
|
|||
|
|
TcxCurrencyEdit(mComponent).SelectAll;
|
|||
|
|
end
|
|||
|
|
else if mComponent is TcxTextEdit then
|
|||
|
|
begin
|
|||
|
|
TcxTextEdit(mComponent).Text := fsj + trim(TSpeedButton(Sender).Caption);
|
|||
|
|
TcxTextEdit(mComponent).SelectAll;
|
|||
|
|
end
|
|||
|
|
else if mComponent is TcxComboBox then
|
|||
|
|
begin
|
|||
|
|
TcxComboBox(mComponent).Text := fsj + trim(TSpeedButton(Sender).Caption);
|
|||
|
|
TcxComboBox(mComponent).SelectAll;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.FrameKeyBoard1SpeedButton_ycClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
cxGroupBox_keys.Visible := false;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.ClearGlobal();
|
|||
|
|
begin
|
|||
|
|
FBCIOID := '';
|
|||
|
|
|
|||
|
|
FQtyUnit := '';
|
|||
|
|
|
|||
|
|
FCIID := '';
|
|||
|
|
FWorkshop := '';
|
|||
|
|
InputLen.Text := '';
|
|||
|
|
Coefficient.Text := '';
|
|||
|
|
AOrdDefNote1.Text := '';
|
|||
|
|
Tare.Text := '';
|
|||
|
|
InputWeight.Text := '';
|
|||
|
|
FLenUnit := '';
|
|||
|
|
Faddwet := 0;
|
|||
|
|
faddlen := 0;
|
|||
|
|
FPacketCIID := '';
|
|||
|
|
FPacketCount := 0;
|
|||
|
|
FC_ColorNo := '';
|
|||
|
|
FC_Code := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.QuantityConversion();
|
|||
|
|
begin
|
|||
|
|
// if trim(OrderNo.Text)='' then exit;
|
|||
|
|
|
|||
|
|
if cds_params.fieldbyName('weightRule').AsInteger = 0 then
|
|||
|
|
// InputWeight ë<><C3AB> OutPutWeight <20><><EFBFBD><EFBFBD>
|
|||
|
|
begin
|
|||
|
|
if lblRuleConversion.Text <> '<27><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>' then
|
|||
|
|
begin
|
|||
|
|
if lblRuleConversion.Text = '<27><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
InputWeight.Text := floattostr(strtofloatdef(trim(InputLen.Text), 0) * strtofloatdef(trim(Coefficient.Text), 0) + strtofloatdef(trim(Tare.Text), 0));
|
|||
|
|
end;
|
|||
|
|
if lblRuleConversion.Text = 'ë<><C3AB>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
InputLen.Text := floattostr(strtofloatdef(trim(InputWeight.Text), 0) * strtofloatdef(trim(Coefficient.Text), 0));
|
|||
|
|
end;
|
|||
|
|
if lblRuleConversion.Text = '<27><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
InputLen.Text := floattostr((RoundFloat(strtofloatdef(trim(InputWeight.Text), 0), 1) - strtofloatdef(trim(Tare.Text), 0)) * strtofloatdef(trim(Coefficient.Text), 0));
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if strtofloatdef(trim(InputWeight.Text), 0) > 0 then
|
|||
|
|
begin
|
|||
|
|
OutPutWeight.Text := floattostr((strtofloatdef(trim(InputWeight.Text), 0) - strtofloatdef(trim(Tare.Text), 0))); // <20><><EFBFBD><EFBFBD>
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if cds_params.fieldbyName('weightRule').AsInteger = 1 then
|
|||
|
|
// InputWeight <20><><EFBFBD><EFBFBD> OutPutWeight ë<><C3AB>
|
|||
|
|
begin
|
|||
|
|
if lblRuleConversion.Text <> '<27><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>' then
|
|||
|
|
begin
|
|||
|
|
if lblRuleConversion.Text = '<27><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
InputWeight.Text := floattostr(strtofloatdef(trim(InputLen.Text), 0) * strtofloatdef(trim(Coefficient.Text), 0));
|
|||
|
|
end;
|
|||
|
|
if lblRuleConversion.Text = 'ë<><C3AB>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
InputLen.Text := floattostr((strtofloatdef(trim(InputWeight.Text), 0) + strtofloatdef(trim(Tare.Text), 0)) * strtofloatdef(trim(Coefficient.Text), 0));
|
|||
|
|
end;
|
|||
|
|
if lblRuleConversion.Text = '<27><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
InputLen.Text := floattostr(RoundFloat(strtofloatdef(trim(InputWeight.Text), 0), 1) * strtofloatdef(trim(Coefficient.Text), 0));
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if strtofloatdef(trim(InputWeight.Text), 0) > 0 then
|
|||
|
|
begin
|
|||
|
|
OutPutWeight.Text := floattostr((strtofloatdef(trim(InputWeight.Text), 0) + strtofloatdef(trim(Tare.Text), 0))); // ë<><C3AB>
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.InitPlan(MSubID: string);
|
|||
|
|
begin
|
|||
|
|
with ADOQueryBaseTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add('EXEC P_Trade_Insp_Get_Market @TMSId=''' + trim(MSubID) + '''');
|
|||
|
|
Open;
|
|||
|
|
|
|||
|
|
if not IsEmpty then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
FLenUnit := trim(ADOQueryBaseTemp.fieldbyName('LenUnit').AsString);
|
|||
|
|
if FLenUnit = '' then
|
|||
|
|
begin
|
|||
|
|
FLenUnit := 'M';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
fLabPackage := 'Ĭ<>ϰ<EFBFBD><CFB0><EFBFBD>ǩ';
|
|||
|
|
fLabVolume := '<27>ͻ<EFBFBD><CDBB><EFBFBD>ǩ';
|
|||
|
|
|
|||
|
|
|
|||
|
|
// fLabPackage := trim(ADOQueryBaseTemp.fieldbyName('LabPackage').AsString);
|
|||
|
|
// fLabVolume := trim(ADOQueryBaseTemp.fieldbyName('LabVolume').AsString);
|
|||
|
|
|
|||
|
|
SetUnit(FLenUnit);
|
|||
|
|
|
|||
|
|
FCDUnit := lblLenUnit.Caption;
|
|||
|
|
FTMSId := trim(fieldbyName('TMSId').AsString);
|
|||
|
|
FBCIOID := trim(fieldbyName('BCIOID').AsString);
|
|||
|
|
|
|||
|
|
FQtyUnit := trim(fieldbyName('QtyUnit').AsString);
|
|||
|
|
OrderNo.Text := trim(fieldbyName('FromOrdNo').AsString);
|
|||
|
|
CodeName.Text := trim(fieldbyName('C_Name').AsString);
|
|||
|
|
C_width.Text := trim(fieldbyName('C_width').AsString);
|
|||
|
|
C_GramWeight.Text := trim(fieldbyName('C_GramWeight').AsString);
|
|||
|
|
ColorNo.Text := trim(fieldbyName('C_ColorNo').AsString);
|
|||
|
|
Color.Text := trim(fieldbyName('C_Color').AsString);
|
|||
|
|
C_Pattern.Text := trim(fieldbyName('C_Pattern').AsString);
|
|||
|
|
FFtyPCId := trim(fieldbyName('FtyPCId').AsString);
|
|||
|
|
FC_Code := trim(fieldbyName('C_Code').AsString);
|
|||
|
|
FC_ColorNo := trim(fieldbyName('C_ColorNo').AsString);
|
|||
|
|
cds_params.Edit;
|
|||
|
|
cds_params.fieldbyName('outPage').value := '<27><>';
|
|||
|
|
cds_params.Post;
|
|||
|
|
|
|||
|
|
// Coefficient.Text := trim(fieldbyName('Coefficient').AsString);
|
|||
|
|
// ת<><D7AA>ϵ<EFBFBD><CFB5>
|
|||
|
|
// lblRuleConversion.ItemIndex := lblRuleConversion.Properties.Items.IndexOf(fieldbyName('RuleConversion').AsString);
|
|||
|
|
|
|||
|
|
FtyPCId.Text := FFtyPCId;
|
|||
|
|
BCIOID.Text := FBCIOID;
|
|||
|
|
|
|||
|
|
Qty.Text := trim(fieldbyName('StkQty').AsString) + trim(fieldbyName('QtyUnit').AsString);
|
|||
|
|
|
|||
|
|
// Tare.Text := trim(fieldbyName('RuleLaterTare').AsString);
|
|||
|
|
|
|||
|
|
fTareType := '';
|
|||
|
|
|
|||
|
|
// if fieldbyName('RuleYardstick').AsInteger > 0 then
|
|||
|
|
// RuleYardstick.Text := trim(fieldbyName('RuleYardstick').AsString)
|
|||
|
|
// else
|
|||
|
|
RuleYardstick.Text := '100';
|
|||
|
|
|
|||
|
|
packnote.Lines.Clear;
|
|||
|
|
|
|||
|
|
InputLen.SetFocus;
|
|||
|
|
setFocusCtrol(InputLen.Name);
|
|||
|
|
SetDdetails();
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
// ClearGlobal();
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
InitJYGrid();
|
|||
|
|
|
|||
|
|
edtScan.Text := '';
|
|||
|
|
|
|||
|
|
// <20><>ʾ<EFBFBD><CABE>
|
|||
|
|
setFormCtrol();
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.InputLenKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
Key := #0;
|
|||
|
|
SelectNext(ActiveControl as TWinControl, true, true);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.InputLenPropertiesChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
// if StrToIntDef(trim(InputWeight.Text), 0) = 0 then
|
|||
|
|
// begin
|
|||
|
|
// exit;
|
|||
|
|
// end;
|
|||
|
|
QuantityConversion();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.lblRuleConversionPropertiesChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if lblRuleConversion.Text = '<27><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>' then
|
|||
|
|
begin
|
|||
|
|
OutPutWeight.Text := '';
|
|||
|
|
InputLen.Text := '';
|
|||
|
|
InputWeight.Text := '';
|
|||
|
|
end;
|
|||
|
|
QuantityConversion();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.SetUnit(MUnit: string);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
lblLenUnit.Caption := MUnit;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
frmParamSet := TfrmParamSet.create(Self);
|
|||
|
|
with frmParamSet do
|
|||
|
|
begin
|
|||
|
|
cds_params.Data := Self.cds_params.Data;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.cds_params.Data := cds_params.Data;
|
|||
|
|
setFormCtrol();
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
SetINIFile();
|
|||
|
|
if trim(fmanage) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
if (trim(MBDYDllName) <> '') and not fIsCommopen then
|
|||
|
|
OpenCom(MBDYDllName);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.ToolButton2Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile: string;
|
|||
|
|
Txt, fImagePath, Txt2, fImagePath2: string;
|
|||
|
|
Moudle: Thandle;
|
|||
|
|
Makebar: TMakebar;
|
|||
|
|
Mixtext: TMixtext;
|
|||
|
|
begin
|
|||
|
|
with ADOQueryPrint do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add(' EXEC P_BS_Cloth_Prt2 ');
|
|||
|
|
SQL.Add(' @Filtration=''' + trim(FBCIOID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryPrint.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
ExportFtErpFile('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ.fr3', ADOQueryBaseTemp);
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ.fr3';
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
frxReport1.LoadFromFile(fPrintFile);
|
|||
|
|
frxReport1.PrintOptions.Copies := cds_params.fieldbyName('labNumber').AsInteger;
|
|||
|
|
frxReport1.PrintOptions.ShowDialog := false;
|
|||
|
|
frxReport1.PrepareReport(True);
|
|||
|
|
frxReport1.Print();
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD>ҵ<EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.ToolButton3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if cds_3.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
PrtData(cds_3.fieldbyName('BCIOID').AsString);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.TrolldelClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MBCIOID: string;
|
|||
|
|
begin
|
|||
|
|
if cds_3.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE>ѡ<EFBFBD><D1A1><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
ADOQueryBaseCmd.Connection.BeginTrans;
|
|||
|
|
try
|
|||
|
|
MBCIOID := trim(cds_3.fieldbyName('BCIOID').AsString);
|
|||
|
|
|
|||
|
|
with ADOQueryBaseCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
Sql.Add('exec P_BS_Cloth_Out_Del ');
|
|||
|
|
Sql.Add(' @BCIOIDS=' + quotedstr(MBCIOID));
|
|||
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryBaseCmd.fieldbyName('intReturn').AsInteger = -1 then
|
|||
|
|
begin
|
|||
|
|
raise Exception.create(pchar(trim(ADOQueryBaseCmd.fieldbyName('ShowMsg').AsString)));
|
|||
|
|
end;
|
|||
|
|
ADOQueryBaseCmd.Connection.CommitTrans;
|
|||
|
|
|
|||
|
|
cds_3.Delete;
|
|||
|
|
Application.MessageBox('ɾ<><C9BE><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
|
except
|
|||
|
|
ADOQueryBaseCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox(pchar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.Tv3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
begin
|
|||
|
|
if AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('Grade').Index] = '<27><>Ʒ' then
|
|||
|
|
ACanvas.Brush.Color := clRed;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.ToolButton8Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.setFocusCtrol(controlName: string);
|
|||
|
|
var
|
|||
|
|
i: Integer;
|
|||
|
|
begin
|
|||
|
|
with FrameKeyBoard1.dxPanel1 do
|
|||
|
|
begin
|
|||
|
|
for i := 0 to ControlCount - 1 do
|
|||
|
|
begin
|
|||
|
|
if Controls[i] is TSpeedButton then
|
|||
|
|
begin
|
|||
|
|
TSpeedButton(Controls[i]).Hint := trim(controlName);
|
|||
|
|
if (trim(controlName) = 'edtScan') and (TSpeedButton(Controls[i]).Name = 'SpeedButton_dot') then
|
|||
|
|
begin
|
|||
|
|
TSpeedButton(Controls[i]).Caption := '<27>س<EFBFBD>';
|
|||
|
|
end
|
|||
|
|
else if (TSpeedButton(Controls[i]).Name = 'SpeedButton_dot') then
|
|||
|
|
begin
|
|||
|
|
TSpeedButton(Controls[i]).Caption := '.';
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
cxGroupBox_keys.Left := Panel_right.Left + 5;
|
|||
|
|
cxGroupBox_keys.Visible := true;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.SetDdetails();
|
|||
|
|
begin
|
|||
|
|
AOrdDefNote1.Text := '';
|
|||
|
|
|
|||
|
|
AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><><EFBFBD><EFBFBD>:' + FBCIOID + #13;
|
|||
|
|
|
|||
|
|
if FRulePieceNo <> '' then
|
|||
|
|
AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><><EFBFBD>Ź<EFBFBD><C5B9><EFBFBD>:' + FRulePieceNo + #13;
|
|||
|
|
|
|||
|
|
if gMachOperators <> '' then
|
|||
|
|
AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><>̨<EFBFBD><CCA8>Ա:' + gMachOperators + #13;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.SetINIFile();
|
|||
|
|
begin
|
|||
|
|
IsDZCDYDll := trim(cds_params.fieldbyName('chen').AsString);
|
|||
|
|
IsMBDYDll := trim(cds_params.fieldbyName('mabiao').AsString);
|
|||
|
|
IsMBDYDllUnit := trim(cds_params.fieldbyName('mbunit').AsString);
|
|||
|
|
|
|||
|
|
LabQty := trim(cds_params.fieldbyName('labNumber').AsString);
|
|||
|
|
FMinLen := trim(cds_params.fieldbyName('minLen').AsString);
|
|||
|
|
FMaxLen := trim(cds_params.fieldbyName('maxLen').AsString);
|
|||
|
|
FMinWeight := trim(cds_params.fieldbyName('minweight').AsString);
|
|||
|
|
FMaxWeight := trim(cds_params.fieldbyName('maxweight').AsString);
|
|||
|
|
|
|||
|
|
FMPlace := trim(cds_params.fieldbyName('mplace').AsString);
|
|||
|
|
FYPlace := trim(cds_params.fieldbyName('yplace').AsString);
|
|||
|
|
FKgPlace := trim(cds_params.fieldbyName('kgplace').AsString);
|
|||
|
|
|
|||
|
|
WriteINIFile();
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.setFormCtrol();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
FrameKeyBoard1.SpeedButton_zdykey1.Caption := gZdyKey1;
|
|||
|
|
// FrameKeyBoard1.SpeedButton_zdykey2.Caption := gZdyKey2;
|
|||
|
|
FrameKeyBoard1.SpeedButton_zdykey2.Caption := gZdyKey2;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
|
presentlen.text := trim(cds_params.fieldbyName('AddLenPresent').AsString);
|
|||
|
|
presentWeight.text := trim(cds_params.fieldbyName('AddwetPresent').AsString);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.GetINIFile();
|
|||
|
|
begin
|
|||
|
|
with cds_params do
|
|||
|
|
begin
|
|||
|
|
if IsEmpty then
|
|||
|
|
Append
|
|||
|
|
else
|
|||
|
|
edit;
|
|||
|
|
fieldbyName('chen').value := IsDZCDYDll;
|
|||
|
|
fieldbyName('mabiao').value := IsMBDYDll;
|
|||
|
|
fieldbyName('mbunit').value := IsMBDYDllUnit;
|
|||
|
|
|
|||
|
|
fieldbyName('MinLen').value := strtointdef(FMinLen, 0);
|
|||
|
|
fieldbyName('MaxLen').value := strtointdef(FMaxLen, 100);
|
|||
|
|
fieldbyName('MinWeight').value := strtointdef(FMinWeight, 0);
|
|||
|
|
fieldbyName('MaxWeight').value := strtointdef(FMaxWeight, 50);
|
|||
|
|
|
|||
|
|
fieldbyName('MPlace').value := strtointdef(FMPlace, 1);
|
|||
|
|
fieldbyName('YPlace').value := strtointdef(FYPlace, 1);
|
|||
|
|
fieldbyName('KgPlace').value := strtointdef(FKgPlace, 1);
|
|||
|
|
|
|||
|
|
fieldbyName('labNumber').value := strtointdef(trim(LabQty), 1);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.InitJYGrid();
|
|||
|
|
var
|
|||
|
|
MNetWeight, MJYLen: double;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
cds_3.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add('select A.*');
|
|||
|
|
SQL.Add('from Bs_Cloth_IO A where IOType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'' and STKID=''' + trim(FBCIOID) + '''');
|
|||
|
|
SQL.Add('order by filltime desc');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryMain, cds_3);
|
|||
|
|
SInitCDSData(ADOQueryMain, cds_3);
|
|||
|
|
|
|||
|
|
finally
|
|||
|
|
cds_3.EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.OpenCom(DllName: string);
|
|||
|
|
type
|
|||
|
|
TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: Integer; IsMessage: Integer): hwnd; stdcall;
|
|||
|
|
var
|
|||
|
|
Tf: TMyFunc;
|
|||
|
|
Tp: TFarProc;
|
|||
|
|
Th: Thandle;
|
|||
|
|
begin
|
|||
|
|
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
|
|||
|
|
fIsCommopen := true;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
fIsCommopen := false;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
// FreeLibrary(Th);
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
fIsCommopen := false;
|
|||
|
|
Application.MessageBox(pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.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 TfrmMachRollMarket.dxLayoutControl_packDblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if gIsCanDesign then
|
|||
|
|
layoutDesign(TdxLayoutControl(Sender), ADOQueryBaseCmd, PWideChar(dcode));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.dxLayoutItem1CaptionClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mkey: Char;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
// frmProductListHelp := TfrmProductListHelp.create(Self);
|
|||
|
|
// with frmProductListHelp do
|
|||
|
|
// begin
|
|||
|
|
// fType := '10';
|
|||
|
|
// if ShowModal = 1 then
|
|||
|
|
// begin
|
|||
|
|
// edtScan.Text := trim(order_main.fieldbyName('Subid').AsString);
|
|||
|
|
// mkey := #13;
|
|||
|
|
// edtScanKeyPress(edtScan, mkey);
|
|||
|
|
// end;
|
|||
|
|
// free;
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
frmTradeClothTotalOutSel := TfrmTradeClothTotalOutSel.create(Self);
|
|||
|
|
with frmTradeClothTotalOutSel do
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
edtScan.Text := trim(CDS_Main.fieldbyName('BCIOID').AsString);
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
mkey := #13;
|
|||
|
|
edtScanKeyPress(edtScan, mkey);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.edtScanDblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
edtScan.Text := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.edtScanEnter(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
setFocusCtrol(TWinControl(Sender).Name);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.edtScanKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
if trim(edtScan.Text) = '' then
|
|||
|
|
exit;
|
|||
|
|
if trim(edtScan.Text) = FBCIOID then
|
|||
|
|
exit;
|
|||
|
|
ClearGlobal();
|
|||
|
|
|
|||
|
|
InitPlan(edtScan.Text);
|
|||
|
|
InitGrid2();
|
|||
|
|
if trim(OrderNo.Text) <> '' then
|
|||
|
|
InputLen.SetFocus;
|
|||
|
|
cxGroupBox_keys.Visible := false;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmMachRollMarket.SaveData(): Boolean;
|
|||
|
|
var
|
|||
|
|
MInputLen, MMeter, MYardage: double;
|
|||
|
|
MInputWeight, MGrossWeight, MNetWeight, MTare, Maddwet, maddLen: double;
|
|||
|
|
mYardStick: double;
|
|||
|
|
mPresentLen, mpresentWeight: double;
|
|||
|
|
MTMSId: string;
|
|||
|
|
begin
|
|||
|
|
Result := false;
|
|||
|
|
MTMSId := Trim(SelTVKey(Tv2, ['TMSId'])[0]);
|
|||
|
|
Maddwet := strTofloatDef(trim(addwet.text), 0); // Faddwet;
|
|||
|
|
maddLen := strTofloatDef(trim(addlen.text), 0); // faddlen;
|
|||
|
|
mYardStick := strtofloatdef(trim(RuleYardstick.Text), 100);
|
|||
|
|
mPresentLen := strTofloatDef(trim(presentlen.text), 0);
|
|||
|
|
mpresentWeight := strTofloatDef(trim(presentWeight.text), 0);
|
|||
|
|
if (strtoIntdef(Trim(unitPieces.Text), 0) > 0) and (strtoIntdef(trim(InputLen.Text), 0) > 0) then
|
|||
|
|
begin
|
|||
|
|
if strtoIntdef(trim(InputLen.Text), 0) > strtoIntdef(Trim(unitPieces.Text), 0) then
|
|||
|
|
funitPiecesStr := intTostr((strtoIntdef(trim(InputLen.Text), 0)) - strtoIntdef(Trim(unitPieces.Text), 0)) + '+' + Trim(unitPieces.Text);
|
|||
|
|
end;
|
|||
|
|
//0:<3A><><EFBFBD>䣻1<E4A3BB><31><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD>
|
|||
|
|
if gPresentNumFlag = 1 then
|
|||
|
|
begin
|
|||
|
|
mPresentLen := -1 * mPresentLen;
|
|||
|
|
mpresentWeight := -1 * mpresentWeight;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
ADOQueryBaseCmd.Connection.BeginTrans;
|
|||
|
|
MTare := strtofloatdef(trim(Tare.Text), 0); // Ƥ<><C6A4>
|
|||
|
|
MInputWeight := RoundFloat(strtofloatdef(trim(InputWeight.Text), 0), cds_params.fieldbyName('KgPlace').AsInteger); // <20><><EFBFBD><EFBFBD>
|
|||
|
|
MGrossWeight := MInputWeight + MTare + Maddwet + mpresentWeight; // ë<><C3AB>
|
|||
|
|
MNetWeight := MInputWeight + Maddwet + mpresentWeight; // <20><><EFBFBD><EFBFBD> +<2B><><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
MInputLen := RoundFloat(strtofloatdef(trim(InputLen.Text), 0), 4);
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+mAddLen
|
|||
|
|
if (uppercase(lblLenUnit.Caption) = 'M') or (lblLenUnit.Caption = '<27><>') then
|
|||
|
|
begin
|
|||
|
|
MMeter := RoundFloat((MInputLen + maddLen + mPresentLen) / (mYardStick / 100), cds_params.fieldbyName('MPlace').AsInteger);
|
|||
|
|
MYardage := RoundFloat(MMeter / 0.9144, cds_params.fieldbyName('YPlace').AsInteger);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
MYardage := RoundFloat((MInputLen + maddLen + mPresentLen) / (mYardStick / 100), cds_params.fieldbyName('YPlace').AsInteger);
|
|||
|
|
MMeter := RoundFloat(MYardage * 0.9144, cds_params.fieldbyName('MPlace').AsInteger);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryBaseCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
Sql.Add('exec P_BS_Cloth_Out_Distribution_KC ');
|
|||
|
|
Sql.Add(' @GrossWeight=' + quotedstr(Trim(FloatToStr(MGrossWeight))));
|
|||
|
|
Sql.Add(' ,@Tare=' + quotedstr(Trim(FloatToStr(MTare))));
|
|||
|
|
Sql.Add(' ,@NetWeight=' + quotedstr(Trim(FloatToStr(MNetWeight))));
|
|||
|
|
Sql.Add(' ,@Meter=' + quotedstr(Trim(FloatToStr(MMeter))));
|
|||
|
|
Sql.Add(' ,@Yardage=' + quotedstr(Trim(FloatToStr(MYardage))));
|
|||
|
|
Sql.Add(' ,@QtyUnit=' + quotedstr(Trim(lblLenUnit.caption)));
|
|||
|
|
Sql.Add(' ,@StkID=' + quotedstr(Trim(FBCIOID)));
|
|||
|
|
Sql.Add(' ,@TMSId =' + quotedstr(MTMSId));
|
|||
|
|
Sql.Add(' ,@Dcode=' + quotedstr(Trim(Dcode)));
|
|||
|
|
Sql.Add(' ,@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
// ShowMessage(sql.Text);
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ADOQueryBaseCmd.fieldbyName('intReturn').AsInteger = -1 then
|
|||
|
|
begin
|
|||
|
|
raise Exception.create(pchar(trim(ADOQueryBaseCmd.fieldbyName('ShowMsg').AsString)));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
FCIID := trim(trim(ADOQueryBaseCmd.fieldbyName('MaxIOID2').AsString));
|
|||
|
|
|
|||
|
|
ADOQueryBaseCmd.Connection.CommitTrans;
|
|||
|
|
TradeMarketProgressUpdate(ADOQueryBaseCmd, MTMSId);
|
|||
|
|
Result := true;
|
|||
|
|
except
|
|||
|
|
ADOQueryBaseCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox(pchar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.PrtData(MCIID: string; againPring: Boolean = false);
|
|||
|
|
var
|
|||
|
|
fPrintFile: string;
|
|||
|
|
Txt, fImagePath, Txt2, fImagePath2: string;
|
|||
|
|
Moudle: Thandle;
|
|||
|
|
Makebar: TMakebar;
|
|||
|
|
Mixtext: TMixtext;
|
|||
|
|
begin
|
|||
|
|
with ADOQueryPrint do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add(' EXEC P_BS_Cloth_Prt2 ');
|
|||
|
|
SQL.Add(' @Filtration=''' + trim(MCIID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryPrint.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// if trim(ADOQueryPrint.fieldbyName('SLabVolume').AsString) <> '' then
|
|||
|
|
// fLabVolume := trim(ADOQueryPrint.fieldbyName('SLabVolume').AsString)
|
|||
|
|
// else
|
|||
|
|
// fLabVolume := trim(ADOQueryPrint.fieldbyName('LabVolume').AsString);
|
|||
|
|
|
|||
|
|
if fLabVolume = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>ñ<EFBFBD>ǩ<EFBFBD><C7A9>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
ExportFtErpFile(fLabVolume + '.fr3', ADOQueryBaseTemp);
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + fLabVolume + '.fr3';
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
frxReport1.LoadFromFile(fPrintFile);
|
|||
|
|
frxReport1.PrintOptions.Copies := cds_params.fieldbyName('labNumber').AsInteger;
|
|||
|
|
frxReport1.PrintOptions.ShowDialog := false;
|
|||
|
|
frxReport1.PrepareReport(True);
|
|||
|
|
frxReport1.Print();
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD>ҵ<EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.BadSpeedButtonClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.On1301(var Message: Tmessage);
|
|||
|
|
var
|
|||
|
|
i1, i2: Integer;
|
|||
|
|
unitname: string;
|
|||
|
|
fdata: double;
|
|||
|
|
begin
|
|||
|
|
i1 := Message.WParam;
|
|||
|
|
i2 := Message.LParam;
|
|||
|
|
|
|||
|
|
if (trim(cds_params.fieldbyName('mabiao').AsString) = '1') then
|
|||
|
|
begin
|
|||
|
|
InputLen.Text := format('%.2f', [i1 / 100000]);
|
|||
|
|
if trim(cds_params.fieldbyName('mbunit').AsString) = '1' then
|
|||
|
|
begin
|
|||
|
|
if i2 = 0 then
|
|||
|
|
begin
|
|||
|
|
SetUnit('M');
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
SetUnit('Y');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMachRollMarket.On1201(var Message: Tmessage);
|
|||
|
|
var
|
|||
|
|
i1, i2: Integer;
|
|||
|
|
unitname: string;
|
|||
|
|
fdata: double;
|
|||
|
|
begin
|
|||
|
|
i1 := Message.WParam;
|
|||
|
|
i2 := Message.LParam;
|
|||
|
|
|
|||
|
|
if trim(cds_params.fieldbyName('chen').AsString) = '1' then
|
|||
|
|
begin
|
|||
|
|
InputWeight.Text := format('%.2f', [i1 / 100000]);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/////////////////////////////////////
|
|||
|
|
function TfrmMachRollMarket.deletePack(packId: string): boolean;
|
|||
|
|
var
|
|||
|
|
ccids: string;
|
|||
|
|
packNo: integer;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ccids := '';
|
|||
|
|
packNo := strtointdef(Trim(cds_3.FieldByName('packetNo').AsString), 0);
|
|||
|
|
ADOQueryBaseCmd.Connection.BeginTrans;
|
|||
|
|
cds_3.First;
|
|||
|
|
while not cds_3.eof do
|
|||
|
|
begin
|
|||
|
|
if Trim(cds_3.FieldByName('packetid').AsString) = packId then
|
|||
|
|
begin
|
|||
|
|
ccids := ccids + ',' + Trim(cds_3.FieldByName('CIID').AsString);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryBaseCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add('insert into Trade_Need_Up(UType,UOperation,UDataId,uoperator) values(''<27><><EFBFBD><EFBFBD>'',''<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>'',' + QuotedStr(Trim(cds_3.FieldByName('CIID').AsString)) + ',' + QuotedStr(DName) + ') ');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
cds_3.Next;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryBaseCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add('exec P_Trade_Insp_Del ');
|
|||
|
|
SQL.Add('@CIIDS=' + QuotedStr(ccids));
|
|||
|
|
SQL.Add(',@DCode=' + QuotedStr(DCode));
|
|||
|
|
SQL.Add(',@DName=' + QuotedStr(DName));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryBaseCmd.fieldbyName('intReturn').AsInteger = -1 then
|
|||
|
|
begin
|
|||
|
|
raise Exception.create(pchar(trim(ADOQueryBaseCmd.fieldbyName('ShowMsg').AsString)));
|
|||
|
|
end;
|
|||
|
|
ADOQueryBaseCmd.Connection.CommitTrans;
|
|||
|
|
|
|||
|
|
InitJYGrid();
|
|||
|
|
Application.MessageBox('ɾ<><C9BE><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
|
except
|
|||
|
|
ADOQueryBaseCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox(pchar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|