D10myBahong/T03贸易布匹检验/U_MachRollMain.pas
DESKTOP-E401PHE\Administrator 8625d20e95 ~
2025-04-30 16:25:49 +08:00

3481 lines
107 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_MachRollMain;
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, dxSkinWXI, frxBarcode,
frxOLE, frxRich, frxClass, frxDBSet, frxTableObject, frxExportPPTX,
frxExportXLSX, frxExportBaseDialog, frxExportXLS, Vcl.Mask, cxSplitter;
type
TfrmMachRollMain = class(TfrmBaseList)
dxLayoutControl_packGroup_Root: TdxLayoutGroup;
dxLayoutControl_pack: TdxLayoutControl;
Piece: TcxTextEdit;
Qty: TcxTextEdit;
Color: TcxTextEdit;
ColorNo: TcxTextEdit;
CodeName: TcxTextEdit;
OrderNo: TcxTextEdit;
edtScan: TcxTextEdit;
Button_set: TButton;
BCIOID: TcxTextEdit;
dxLayoutGroup_scan: TdxLayoutGroup;
dxLayoutItem1: TdxLayoutItem;
dxLayoutItem2: TdxLayoutItem;
dxLayoutItem3: TdxLayoutItem;
dxLayoutGroup_plan: TdxLayoutGroup;
dxLayoutItem5: TdxLayoutItem;
dxLayoutItem6: TdxLayoutItem;
dxLayoutGroup_plan_1: TdxLayoutGroup;
dxLayoutGroup_plan_2: TdxLayoutGroup;
dxLayoutItem7: TdxLayoutItem;
dxLayoutItem8: TdxLayoutItem;
dxLayoutItem9: TdxLayoutItem;
dxLayoutItem10: TdxLayoutItem;
dxLayoutItem11: TdxLayoutItem;
dxLayoutEmptySpaceItem1: TdxLayoutEmptySpaceItem;
InputLen: TcxTextEdit;
BTPrint: TButton;
Button_bad: TButton;
btnRK: TButton;
Edit_pieceOrder: TcxTextEdit;
Edit_fixLen: TcxTextEdit;
Tare: TcxTextEdit;
Coefficient: TcxTextEdit;
InputWeight: TcxTextEdit;
BatchNO: TcxTextEdit;
PieceNo: TcxTextEdit;
OutPutWeight: TcxTextEdit;
edtPacketNo: TcxTextEdit;
dxLayoutGroup_do: TdxLayoutGroup;
dxLayoutItem13: TdxLayoutItem;
dxLayoutItem_roll: TdxLayoutItem;
dxLayoutGroup_do1: TdxLayoutGroup;
dxLayoutGroup_do2: TdxLayoutGroup;
dxLayoutItem15: TdxLayoutItem;
dxLayoutItem16: TdxLayoutItem;
dxLayoutItem_outweight: TdxLayoutItem;
lblLenUnit: TdxLayoutLabeledItem;
dxLayoutItem18: TdxLayoutItem;
dxLayoutLabeledItem2: TdxLayoutLabeledItem;
dxLayoutItem_packno: TdxLayoutItem;
dxLayoutItem_rk: TdxLayoutItem;
dxLayoutItem21: TdxLayoutItem;
dxLayoutEmptySpaceItem3: TdxLayoutEmptySpaceItem;
dxLayoutAutoCreatedGroup1: TdxLayoutAutoCreatedGroup;
dxLayoutAutoCreatedGroup3: TdxLayoutAutoCreatedGroup;
dxLayoutAutoCreatedGroup5: TdxLayoutAutoCreatedGroup;
dxLayoutGroup1: TdxLayoutGroup;
dxLayoutItem_pieceorder: TdxLayoutItem;
dxLayoutItem_fixlen: TdxLayoutItem;
dxLayoutEmptySpaceItem5: TdxLayoutEmptySpaceItem;
dxLayoutItem24: TdxLayoutItem;
dxLayoutGroup2: TdxLayoutGroup;
cxDBImage1: TcxDBImage;
Panel_right: TPanel;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
v3PieceNo: TcxGridDBColumn;
Tv3Yardage: TcxGridDBColumn;
Tv3Meter: TcxGridDBColumn;
v3NetWeight: TcxGridDBColumn;
v3GrossWeight: TcxGridDBColumn;
Tv3Grade: TcxGridDBColumn;
tv3CIID: TcxGridDBColumn;
Tv3BatchNO: TcxGridDBColumn;
Tv3PacketNo: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
cxPageControl1: TcxPageControl;
cxTabSheet1: TcxTabSheet;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
tv2CDType: TcxGridDBColumn;
tv2CDWZ: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
Tv2CDQty: TcxGridDBColumn;
Tv2CDReason: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
v2Column4: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
<EFBFBD>: TcxTabSheet;
cxGrid1: TcxGrid;
TV1: TcxGridDBTableView;
cxGridDBColumn2: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
cxGridDBColumn5: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
cxGridDBColumn8: TcxGridDBColumn;
cxGridDBColumn9: TcxGridDBColumn;
cxGridLevel3: TcxGridLevel;
ToolBar2: TToolBar;
ToolButton3: TToolButton;
Trolldel: TToolButton;
Tedit: TToolButton;
ToolButton4: TToolButton;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
dxLayoutItem_zhfield: TdxLayoutItem;
AOrdDefNote1: TcxRichEdit;
dxLayoutItem_pic: TdxLayoutItem;
dxLayoutAutoCreatedGroup2: TdxLayoutAutoCreatedGroup;
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;
RM1: TRMGridReport;
grade: TcxComboBox;
dxLayoutItem_grade: TdxLayoutItem;
dxLayoutItem17: TdxLayoutItem;
btnUnRk: TButton;
Btn_rlBill: TButton;
dxLayoutItem_unrk: TdxLayoutItem;
dxLayoutItem_rkd: TdxLayoutItem;
Tv3FtyPCId: TcxGridDBColumn;
cds_paramsEndPieceNo: TIntegerField;
cds_paramsBeginPieceNo: TIntegerField;
cds_paramsFixedLength: TIntegerField;
cds_paramspacknoMake: TStringField;
cds_paramspieceOrder: TBooleanField;
lblRuleConversion: TcxComboBox;
dxLayoutItem14: TdxLayoutItem;
dxLayoutAutoCreatedGroup4: TdxLayoutAutoCreatedGroup;
cds_paramsLabVolume: TStringField;
cds_paramsLabPackage: TStringField;
dxLayoutItem_packnote: TdxLayoutItem;
packnote: TcxMemo;
ffRMDB_1: TRMDBDataSet;
TprintPack: TToolButton;
Tlog: TToolButton;
dxPanel_mid: TdxPanel;
cxGroupBox_keys: TcxGroupBox;
FrameKeyBoard1: TFrameKeyBoard;
frameBads1: TframeBads;
dxLayoutItem_Pattern: TdxLayoutItem;
C_Pattern: TcxTextEdit;
Tv2SubtractQty: TcxGridDBColumn;
TV1SubtractQty: TcxGridDBColumn;
Tv3SubtractQty: TcxGridDBColumn;
RuleYardstick: TcxTextEdit;
dxLayoutItem_RuleYardstick: TdxLayoutItem;
cds_paramsAddwetPresent: TFloatField;
cds_paramsAddLenPresent: TFloatField;
C_StyleNo: TcxTextEdit;
dxLayoutItem_StyleNo: TdxLayoutItem;
Tv3AddwetPresent: TcxGridDBColumn;
Tv3AddLenPresent: TcxGridDBColumn;
cxGridPopupMenu1: TcxGridPopupMenu;
MovePanel1: TMovePanel;
ADOQueryImage: TADOQuery;
DS_IMAGE: TDataSource;
cds_paramspackPrintPreview: TBooleanField;
RMRichObject1: TRMRichObject;
cds_paramspacklabNumber: TIntegerField;
cds_paramspackPostAction: TStringField;
packPostBtn: TButton;
dxLayoutItem_packpost: TdxLayoutItem;
customStrField1: TcxTextEdit;
dxLayoutItem_customStrField1: TdxLayoutItem;
dxLayoutItem_customStrField2: TdxLayoutItem;
customStrField2: TcxTextEdit;
dxLayoutItem_width: TdxLayoutItem;
dxLayoutItem_gram: TdxLayoutItem;
C_Width: TcxTextEdit;
C_GramWeight: TcxTextEdit;
dxLayoutItem_addlen: TdxLayoutItem;
dxLayoutItem_addwet: TdxLayoutItem;
Tv3addlen: TcxGridDBColumn;
Tv3addWet: TcxGridDBColumn;
addLen: TcxTextEdit;
addWet: TcxTextEdit;
bt_printmd: TButton;
dxLayoutItem_btprintmd: TdxLayoutItem;
TgridLiSet: TToolButton;
dxLayoutItem_presentLen: TdxLayoutItem;
dxLayoutItem_presentWeight: TdxLayoutItem;
presentLen: TcxTextEdit;
presentWeight: TcxTextEdit;
unitPieces: TcxTextEdit;
dxLayoutItem_unitPieces: TdxLayoutItem;
Tv3unitPieces: TcxGridDBColumn;
frxXLSExport1: TfrxXLSExport;
frxXLSXExport1: TfrxXLSXExport;
frxPPTXExport1: TfrxPPTXExport;
frxReportTableObject1: TfrxReportTableObject;
frxReport1: TfrxReport;
RMDB_1: TfrxDBDataset;
frxRichObject1: TfrxRichObject;
frxOLEObject1: TfrxOLEObject;
frxBarCodeObject1: TfrxBarCodeObject;
BAN: TSpeedButton;
dxLayoutItem20: TdxLayoutItem;
ADOCmd: TADOQuery;
ADOQuery1: TADOQuery;
ADOTemp: TADOQuery;
PlateNo: TcxTextEdit;
dxLayoutItem12: TdxLayoutItem;
Tv3Column1: TcxGridDBColumn;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
Tv3Column2: TcxGridDBColumn;
dxLayoutItem19: TdxLayoutItem;
FtyPCId: TcxTextEdit;
Tv3Column3: TcxGridDBColumn;
cxSplitter1: TcxSplitter;
edtChen: TcxTextEdit;
dxLayoutItem_chen: TdxLayoutItem;
edtMaBiao: TcxTextEdit;
dxLayoutItem4: TdxLayoutItem;
outPage: TcxTextEdit;
dxLayoutItem22: TdxLayoutItem;
labNumber: TComboBox;
dxLayoutItem23: TdxLayoutItem;
dxLayoutAutoCreatedGroup7: TdxLayoutAutoCreatedGroup;
dxLayoutAutoCreatedGroup9: TdxLayoutAutoCreatedGroup;
dxLayoutAutoCreatedGroup8: TdxLayoutAutoCreatedGroup;
dxLayoutAutoCreatedGroup10: TdxLayoutAutoCreatedGroup;
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button_badClick(Sender: TObject);
procedure frameBads1cxButton3Click(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 frameBads1cxCheckBox_readLenPropertiesChange(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton_backClick(Sender: TObject);
procedure edtScanEnter(Sender: TObject);
procedure Edit_fixLenClick(Sender: TObject);
procedure BTPrintClick(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure TrolldelClick(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure TeditClick(Sender: TObject);
procedure cxButton2Click(Sender: TObject);
procedure Tv3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure Tv3FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
procedure Button_setClick(Sender: TObject);
procedure InputLenKeyPress(Sender: TObject; var Key: Char);
procedure InputLenPropertiesChange(Sender: TObject);
procedure btnRKClick(Sender: TObject);
procedure btnUnRkClick(Sender: TObject);
procedure Btn_rlBillClick(Sender: TObject);
procedure Edit_pieceOrderClick(Sender: TObject);
procedure TprintPackClick(Sender: TObject);
procedure TlogClick(Sender: TObject);
procedure FrameKeyBoard1SpeedButton_backClick(Sender: TObject);
procedure FrameKeyBoard1SpeedButton1Click(Sender: TObject);
procedure FrameKeyBoard1SpeedButton_ycClick(Sender: TObject);
procedure dxLayoutItem1CaptionClick(Sender: TObject);
procedure Tv2DblClick(Sender: TObject);
procedure lblRuleConversionPropertiesChange(Sender: TObject);
procedure packPostBtnClick(Sender: TObject);
procedure frameBads1CIFBegDblClick(Sender: TObject);
procedure frameBads1cxCheck_lenPropertiesChange(Sender: TObject);
procedure bt_printmdClick(Sender: TObject);
procedure dxLayoutControl_packDblClick(Sender: TObject);
procedure FtyPCIdChange(Sender: TObject);
procedure BANClick(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure BatchNOExit(Sender: TObject);
procedure edtChenClick(Sender: TObject);
procedure edtMaBiaoClick(Sender: TObject);
procedure outPageClick(Sender: TObject);
procedure labNumberChange(Sender: TObject);
private
FCIID, FOperationStatus, FCIFName, FWorkshop: string;
FBCIOID, FOrderNo, FMainId, FSubId, FPCId, FConNo, FConMId, fBuyConNo, FConSId: string;
FBatchNO, FLenUnit, FC_Code, FC_Name, FC_EName, FC_Spec, FC_Width, FC_GramWeight: string;
FC_Color, FC_EColor, FC_ColorNo, FC_StyleNo, FC_Composition, FC_Pattern, FC_CustPattern, FC_ColorDepth: string;
Faddwet, faddlen: double;
FFtyPCId, FGangNo, FRulePieceNo, FRulePackNo, 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 CIFEndChange(Sender: TObject);
function CheckData(CKType: string): Boolean;
procedure QuantityConversion();
procedure ClearGlobal();
procedure InitPlan(MSubID: string);
procedure SetUnit(MUnit: string);
procedure SetDdetails();
procedure SetINIFile();
procedure GetINIFile();
procedure InitCDGrid(MCIID: string);
procedure InitCDGridCX(MCIID: string);
procedure InitJYGrid();
procedure OpenCom(DllName: string);
procedure CloseCom(DllName: string);
function SaveData(): Boolean;
procedure PrtData(MCIID: string; againPring: Boolean = false);
procedure PrintBao(PPacketId: string; againPring: Boolean = false);
procedure InitJTM(MCIID: string);
procedure BadSpeedButtonClick(Sender: TObject);
procedure setFormCtrol();
procedure PrtMD(MInNo: string);
procedure On1201(var Message: Tmessage); message 1201; // <20><><EFBFBD>ӳ<EFBFBD>
procedure On1301(var Message: Tmessage); message 1301; // <20><><EFBFBD><EFBFBD>
procedure initEditPiece();
procedure GetPacketNo();
procedure GetRulePacketNo();
procedure getPlanImage(MSubID: string);
function deletePack(packId: string): boolean;
function checkPicecNo(): boolean;
function getCurPieceNO(mCcid: string): string;
function InitDevComboboxG(ADOQueryTmp: TADOQuery; combobox: TcxCombobox; mFlag: string; selFlag: Boolean = true): Boolean;
type
public
fmanage: string;
fFlileFlag: string;
end;
var
frmMachRollMain: TfrmMachRollMain;
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_LabelPrint;
{$R *.dfm}
procedure TfrmMachRollMain.Btn_rlBillClick(Sender: TObject);
begin
if cds_3.IsEmpty then
exit;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD>´<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
exit;
try
with ADOQueryBaseTemp do
begin
Close;
SQL.Clear;
SQL.Add(' select * from BS_Cloth_IO A where IOFlag=''<27><><EFBFBD><EFBFBD>'' ');
SQL.Add(' and A.StkId=''' + trim(cds_3.fieldbyName('CIID').AsString) + '''');
Open;
end;
PrtMD(ADOQueryBaseTemp.fieldbyName('IONo').AsString);
except
Application.MessageBox('<27><><EFBFBD>´<EFBFBD>ӡʧ<D3A1><CAA7>!', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
end;
end;
procedure TfrmMachRollMain.BTPrintClick(Sender: TObject);
var
fPrintFile, MPacketId, MPlateId: string;
mvalue: double;
i: Integer;
begin
try
BTPrint.Enabled := false;
edtScan.SetFocus;
if trim(OrderNo.Text) = '' then
exit;
if trim(grade.Text) = '' then
begin
Application.MessageBox('<27>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
exit;
end;
with ADOCmd do
begin
Close;
SQL.Clear;
SQL.Add(' select * from BS_Cloth_IO A where STKName='<>״<EFBFBD><D7B4>첼'' ');
SQL.Add(' and A.FromSubId=''' + trim(Fsubid) + '''');
Open;
end;
if ADOCmd.IsEmpty then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɫδ<C9AB>ڴ<EFBFBD><DAB4><EFBFBD>ֿ⣬<D6BF><E2A3AC><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
if CheckData('<27>ύ') = false then
exit;
if FCDUnit <> lblLenUnit.CaptionOptions.Hint then
begin
Application.MessageBox('<27><>λ<EFBFBD><CEBB><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>!', '<27><>ʾ', 0);
exit;
end;
if SaveData() then
begin
InputLen.Text := '';
presentLen.Text := '';
funitPiecesStr := '';
presentWeight.Text := '';
if BTPrint.Caption = '<27>޸<EFBFBD><DEB8>ύ' then
begin
BTPrint.Caption := '<27><> <20><>';
cds_params.edit;
cds_params.fieldbyName('chen').value := '1';
cds_params.fieldbyName('mabiao').value := '1';
cds_params.Post;
edtPacketNo.Enabled := true;
if fileexists(ExtractFilePath(Application.ExeName) + '<27>޸ijɹ<C4B3>.wav') then
playSound(pwidechar('<27>޸ijɹ<C4B3>.wav'), 0, SND_FILENAME or SND_ASYNC);
end
else
begin
if fileexists(ExtractFilePath(Application.ExeName) + '<27><>ȷ.wav') then
playSound(pwidechar('<27><>ȷ.wav'), 0, SND_FILENAME or SND_ASYNC);
end;
InputWeight.Text := '';
// Edit_fixLen.Text := '';
if (trim(Edit_pieceOrder.Text) = '<27><>') and (strtointdef(trim(PieceNo.Text), 0) > 1) then
begin
PieceNo.Text := inttostr(strtointdef(PieceNo.Text, 0) - 1); // <20>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>
end
else if (trim(cds_params.fieldbyName('beginPieceNo').AsString) <> '') then
begin
if strtointdef(trim(PieceNo.Text), 0) < strtointdef(trim(cds_params.fieldbyName('endPieceNo').AsString), 0) then
begin
PieceNo.Text := inttostr(strtointdef(trim(PieceNo.Text), 0) + 1); //
end
else
PieceNo.Text := getCurPieceNO(FCIID); //
end
else if (trim(cds_params.fieldbyName('rollnoMake').AsString) = '<27>Զ<EFBFBD>') then // (strtointdef(PieceNo.Text, 0) > 0)
begin
PieceNo.Text := inttostr(strtointdef(trim(PieceNo.Text), 0) + 1); //
end
else
begin
if dxLayoutItem_roll.ActuallyVisible then
begin
PieceNo.Text := getCurPieceNO(FCIID); //
end
else
PieceNo.Text := '';
end;
OutPutWeight.Text := '';
// PieceNo.Text := inttostr(strtointdef(PieceNo.Text, 0) + 1); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if trim(cds_params.fieldbyName('outPage').AsString) = '<27><>' then
begin
PrtData(FCIID);
end;
if (trim(cds_params.fieldbyName('dabao').AsString) = '<27><>') then
begin
FPacketCount := FPacketCount + 1;
FPacketCIID := FPacketCIID + ',' + FCIID;
if (trim(cds_params.fieldbyName('packPostAction').AsString) = '<27>Զ<EFBFBD>') and (FPacketCount = cds_params.fieldbyName('packRolls').AsInteger) then
begin
if GetLSNo(ADOQueryBaseTemp, MPacketId, 'BI', 'Trade_Cloth_Inspect', 4, 1) = false then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
exit;
end;
try
ADOQueryBaseCmd.Connection.BeginTrans;
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('Update Trade_Cloth_Inspect Set PacketTime=GETDATE() , PacketNo=' + trim(edtPacketNo.Text) + ',PacketId=' + QuotedStr(trim(MPacketId)) + ',PacketCode=' + QuotedStr(trim(DCode)) + ',PacketName=' + QuotedStr(trim(DName)));
SQL.Add('WHERE EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + QuotedStr(FPacketCIID) + ','','') X where Trade_Cloth_Inspect.CIID=X.RTValue ) ');
SQL.Add('Update Bs_Cloth_IO Set PacketTime=GETDATE() , PacketNo=' + trim(edtPacketNo.Text) + ',PacketId=' + QuotedStr(trim(MPacketId)) + ',PacketCode=' + QuotedStr(trim(DCode)) + ',PacketName=' + QuotedStr(trim(DName)));
SQL.Add('WHERE EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + QuotedStr(FPacketCIID) + ','','') X where Bs_Cloth_IO.STKID=X.RTValue ) ');
ExecSQL;
end;
if (cds_params.fieldbyName('packlabnumber').AsInteger > 0) then
PrintBao(MPacketId);
// edtPacketNo.Text := inttostr(strtoint(edtPacketNo.Text) + 1);
GetRulePacketNo();
FPacketCIID := '';
FPacketCount := 0;
ADOQueryBaseCmd.Connection.CommitTrans;
except
ADOQueryBaseCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
end;
end;
InputLen.SetFocus;
setFocusCtrol(InputLen.Name);
FOperationStatus := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
InitJYGrid();
InitCDGrid('');
FCIID := '';
finally
BTPrint.Enabled := true;
end;
end;
procedure TfrmMachRollMain.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 TfrmMachRollMain.Button_badClick(Sender: TObject);
begin
inherited;
cxPageControl1.ActivePageIndex := 0;
dxPanel_mid.Visible := not dxPanel_mid.Visible;
cxGroupBox_keys.Left := Panel_right.Left + 15;
end;
procedure TfrmMachRollMain.Button_setClick(Sender: TObject);
begin
if trim(BCIOID.Text) = '' then
begin
exit;
end;
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(DZCDYDllName) <> '') and not fIsCommopen then
// OpenCom(DZCDYDllName);
if (trim(MBDYDllName) <> '') and not fIsCommopen then
OpenCom(MBDYDllName);
// edtScan.SetFocus;
end;
end;
procedure TfrmMachRollMain.BANClick(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_Print_Ban ''' + trim(fmainId) + ''', ''' + Trim(PlateNo.Text) + ''' ');
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('<27><><EFBFBD><EFBFBD>ǩ.rmf', ADOQueryBaseTemp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ǩ.rmf';
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
RM1.DefaultCopies := 1;
RM1.PrintReport;
end
else
begin
Application.MessageBox(pchar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
PlateNo.Text := inttostr(strtoint(PlateNo.Text) + 1);
end;
procedure TfrmMachRollMain.BatchNOExit(Sender: TObject);
begin
if BTPrint.Caption = '<27><> <20><>' then
begin
with ADOQueryBaseCmd do
begin
Close;
sql.Clear;
if FRulePieceNo = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
sql.Add('select maxRoll=1+isnull(cast(max(PieceNo) as int),0) from Trade_Cloth_Inspect X where X.mainID=' + quotedstr(Trim(FMainId)));
end
else if FRulePieceNo = '<27><><EFBFBD>׺<EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
begin
sql.Add('select maxRoll=1+isnull(cast(max(PieceNo) as int),0)from Trade_Cloth_Inspect X ');
sql.Add('where X.mainID=''' + Trim(FMainId) + ''' and X.subid=''' + Trim(FSubId) + ''' and X.c_color=' + quotedstr(Trim(FC_Color)) + ' and isnull(X.BatchNO,'''')=' + quotedstr(Trim(BatchNO.Text)));
end
else if FRulePieceNo = '<27><><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>' then
begin
sql.Add('select maxRoll=1+isnull(cast(max(PieceNo) as int),0) from Trade_Cloth_Inspect X ');
sql.Add('where X.mainID=''' + Trim(FMainId) + ''' and X.subid=''' + Trim(FSubId) + ''' and X.c_color=' + quotedstr(Trim(FC_Color)));
end
else if (FRulePieceNo = '<27>ֶ<EFBFBD>') or (FRulePieceNo = '<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>') then
begin
end
else
begin
sql.Add('select maxRoll=1+isnull(cast(max(PieceNo) as int),0) ');
sql.Add('from Trade_Cloth_Inspect X where X.subID=''' + trim(FSubId) + ''' ');
end;
Open;
end;
PieceNo.Text := Trim(ADOQueryBaseCmd.fieldbyname('maxRoll').AsString);
end;
end;
procedure TfrmMachRollMain.btnRKClick(Sender: TObject);
var
MINo, MStkIds: string;
begin
if cds_3.IsEmpty then
exit;
if Application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?', '<27><>ʾ<EFBFBD><CABE>Ϣ', 1) = 2 then
begin
exit;
end;
btnRK.Enabled := false;
// ˢ<><CBA2>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>Ϣ<EFBFBD><CFA2>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
with ADOQueryMain do
begin
Close;
SQL.Clear;
SQL.Add('select A.*');
SQL.Add('from Trade_Cloth_Inspect A where BCIOID=''' + trim(FBCIOID) + '''');
SQL.Add('and CIIOFlag='<><CEB4><EFBFBD><EFBFBD>''');
SQL.Add('order by filltime desc');
Open;
end;
SCreateCDS(ADOQueryMain, cds_3);
SInitCDSData(ADOQueryMain, cds_3);
with cds_3 do
begin
DisableControls;
First;
while not eof do
begin
MStkIds := MStkIds + trim(cds_3.fieldbyName('CIID').AsString) + ',';
next;
end;
EnableControls;
end;
MStkIds := copy(MStkIds, 1, Length(MStkIds) - 1);
if GetLSNo(ADOQueryBaseCmd, MINo, '9', 'BS_Cloth_IO', 4, 1) = false then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><E2B5A5>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
exit;
end;
ADOQueryBaseCmd.Connection.BeginTrans;
try
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('exec P_BS_Cloth_In_Insp ');
SQL.Add(' @CIIDS=' + QuotedStr(trim(MStkIds)));
SQL.Add(',@IOTime=' + QuotedStr(FormatDateTime('yyyy-MM-dd', SGetServerDate(ADOQueryBaseTemp))));
SQL.Add(',@IOType=' + QuotedStr('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'));
SQL.Add(',@IONO=' + QuotedStr(MINo));
SQL.Add(',@FillId=' + QuotedStr(DCode));
SQL.Add(',@Filler=' + 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;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
btnRK.Enabled := true;
except
btnRK.Enabled := true;
ADOQueryBaseCmd.Connection.RollbackTrans;
Application.MessageBox(pchar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
InitJYGrid();
end;
procedure TfrmMachRollMain.btnUnRkClick(Sender: TObject);
var
MStkIds: string;
begin
if cds_3.IsEmpty then
exit;
if Application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?', '<27><>ʾ<EFBFBD><CABE>Ϣ', 1) = 2 then
begin
exit;
end;
btnUnRk.Enabled := false;
with cds_3 do
begin
DisableControls;
First;
while not eof do
begin
MStkIds := MStkIds + trim(cds_3.fieldbyName('CIID').AsString) + ',';
next;
end;
EnableControls;
end;
MStkIds := copy(MStkIds, 1, Length(MStkIds) - 1);
try
ADOQueryBaseCmd.Connection.BeginTrans;
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('exec P_Trade_Cloth_ReIn ');
SQL.Add('@StkIds=' + QuotedStr(trim(MStkIds)));
SQL.Add(',@IOIDS='''' ');
Open;
end;
if ADOQueryBaseCmd.fieldbyName('intReturn').AsInteger = -1 then
begin
raise Exception.create(pchar(trim(ADOQueryBaseCmd.fieldbyName('ShowMsg').AsString)));
end;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
ADOQueryBaseCmd.Connection.CommitTrans;
btnUnRk.Enabled := true;
except
ADOQueryBaseCmd.Connection.RollbackTrans;
btnUnRk.Enabled := true;
Application.MessageBox(pchar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmMachRollMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
if fIsCommopen then
begin
CloseCom(DZCDYDllName);
CloseCom(MBDYDllName);
end;
Action := caFree;
end;
procedure TfrmMachRollMain.FormCreate(Sender: TObject);
begin
inherited;
fIsCommopen := false;
cds_params.Close;
cds_params.CreateDataSet;
Panel_right.Align := alClient;
frameBads1.CIFBeg.OnEnter := edtScanEnter;
frameBads1.CIFEnd.OnEnter := edtScanEnter;
frameBads1.CIFNumber.OnEnter := edtScanEnter;
frameBads1.SubtractQty.OnEnter := edtScanEnter;
frameBads1.CIFQty.OnEnter := edtScanEnter;
end;
procedure TfrmMachRollMain.FormDestroy(Sender: TObject);
begin
inherited;
frmMachRollMain := nil;
end;
function TfrmMachRollMain.InitDevComboboxG(ADOQueryTmp: TADOQuery; combobox: TcxCombobox; mFlag: string; selFlag: Boolean = true): Boolean;
begin
Result := false;
try
with ADOQueryTmp do
begin
close;
sql.Clear;
sql.Add('select a.itemText from SY_Dict_Item a');
sql.Add(' inner join SY_Dict b on b.dictId=a.dictId');
sql.Add(' where b.dictcode=' + QuotedStr(mFlag));
sql.Add('and a.valid=1 and b.valid=1');
sql.Add('order by A.sortorder');
Open;
if IsEmpty then
begin
application.MessageBox(PWideChar(<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ֶ<EFBFBD><D6B6>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>(' + mFlag + ')'), '', 0);
Exit;
end;
combobox.Properties.BeginUpdate;
combobox.Properties.Items.Clear;
first;
while not eof do
begin
combobox.Properties.Items.Add(trim(FieldByName('itemText').AsString));
next;
end;
if selFlag and (combobox.Properties.Items.Count > 0) then
begin
combobox.ItemIndex := 0;
end;
combobox.Properties.EndUpdate();
end;
except
raise Exception.Create(PWideChar('<27><>ȡ<EFBFBD>ֶ<EFBFBD><D6B6>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>(' + mFlag + ')ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!'));
end;
end;
procedure TfrmMachRollMain.FormShow(Sender: TObject);
var
i: Integer;
begin
// inherited;
// gIsCanDesign := IsHasDesignRight(ADOQueryBaseTemp, PWideChar(dCode));
gGridNativeSet := true;
if gIsCanDesign then
begin
cxGridPopupMenu1.Grid := cxGrid3;
end;
TgridLiSet.Visible := gIsCanDesign;
InitDevComboboxG(ADOQueryBaseTemp, grade, 'CPGRADE');
ReadCxGrid(trim(Self.Caption) + 'Tv1', TV1, gDllFileCaption);
ReadCxGrid(trim(Self.Caption) + 'Tv2', Tv2, gDllFileCaption);
ReadCxGrid(trim(Self.Caption) + 'Tv3', Tv3, gDllFileCaption);
// fDllFileName + '|' + Self.Name + '|' + dxLayoutControl_pack.Name+ '.ini'
readLayOut(dxLayoutControl_pack, ADOQueryBaseTemp, PWideChar(fDllFileName + '|' + self.name + '|' + dxLayoutControl_pack.Name + '.ini'));
frameBads1.fBadBtnSize := gBcSpeedSize;
frameBads1.InitBadPanel;
with frameBads1.cxScrollBox1 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TSpeedButton then
begin
TSpeedButton(Controls[i]).OnClick := BadSpeedButtonClick;
end;
end;
end;
InitCDGrid(FCIID);
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);
// edtScan.SetFocus;
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;
dxLayoutItem20.Visible := true;
if not cds_params.IsEmpty then
begin
cds_params.Edit;
with cds_params do
begin
cds_params.fieldByName('chen').Value := '1';
cds_params.fieldByName('mabiao').Value := '1';
cds_params.fieldByName('outPage').Value := '<27><>';
cds_params.fieldByName('labNumber').Value := StrToIntDef(labNumber.Text, 1);
end;
cds_params.Post;
end;
end;
procedure TfrmMachRollMain.frameBads1CIFBegDblClick(Sender: TObject);
begin
inherited;
if strTofloatDef(trim(frameBads1.CIFBeg.text), 0) = 0 then
frameBads1.CIFBeg.text := inputLen.Text;
end;
procedure TfrmMachRollMain.frameBads1cxButton3Click(Sender: TObject);
begin
inherited;
frameBads1.Visible := false;
end;
procedure TfrmMachRollMain.frameBads1cxCheckBox_readLenPropertiesChange(Sender: TObject);
begin
inherited;
frameBads1.CIFBeg.Text := '';
// if trim(TcxTextEdit(Sender).Text) = '' then
// begin
// frameBads1.CIFBeg.Text := '';
// end
// else
// begin
// frameBads1.CIFBeg.Text := '';
// end;
end;
procedure TfrmMachRollMain.frameBads1cxCheck_lenPropertiesChange(Sender: TObject);
begin
inherited;
if frameBads1.cxCheck_len.Checked and (trim(InputLen.Text) <> '') then
begin
frameBads1.CIFBeg.Text := trim(InputLen.Text);
frameBads1.CIFEnd.SetFocus;
end
else
begin
frameBads1.CIFBeg.Text := ''
end;
end;
procedure TfrmMachRollMain.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
mComponent := frameBads1.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
begin
TcxTextEdit(mComponent).Text := fsj + trim(TSpeedButton(Sender).Caption);
TcxTextEdit(mComponent).SelectAll;
end;
end;
procedure TfrmMachRollMain.FrameKeyBoard1SpeedButton_backClick(Sender: TObject);
var
fsj: string;
mComponent: TComponent;
begin
mComponent := FindComponent(trim(TSpeedButton(Sender).Hint));
if mComponent = nil then
mComponent := frameBads1.FindComponent(trim(TSpeedButton(Sender).Hint));
if mComponent = nil then
exit;
fsj := trim(TcxTextEdit(mComponent).Text);
if trim(fsj) = '' then
exit;
TcxTextEdit(mComponent).Text := copy(fsj, 1, Length(fsj) - 1);
TcxTextEdit(mComponent).SelectAll;
end;
procedure TfrmMachRollMain.FrameKeyBoard1SpeedButton_ycClick(Sender: TObject);
begin
inherited;
cxGroupBox_keys.Visible := false;
end;
procedure TfrmMachRollMain.FtyPCIdChange(Sender: TObject);
begin
// BatchNO.Text := FtyPCId.Text;
end;
function TfrmMachRollMain.CheckData(CKType: string): Boolean;
var
mvalue: double;
mCurPieceNo: Integer;
begin
Result := false;
mCurPieceNo := strtointdef(trim(Pieceno.Text), 0);
try
if trim(FBCIOID) = '' then
raise Exception.create('<27><>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF><EFBFBD>');
if trim(CKType) = '<27>ύ' then
begin
if (cds_params.fieldbyName('BeginPieceNo').AsInteger > cds_params.fieldbyName('endPieceNo').AsInteger) then
begin
if (mCurPieceNo > 0) and not ((mCurPieceNo <= cds_params.fieldbyName('BeginPieceNo').AsInteger) and (mCurPieceNo >= cds_params.fieldbyName('endPieceNo').AsInteger)) then
begin
Application.MessageBox('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õķ<C3B5>Χ<EFBFBD><CEA7>!', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
Exit;
end;
end;
if (cds_params.fieldbyName('BeginPieceNo').AsInteger < cds_params.fieldbyName('endPieceNo').AsInteger) then
begin
if (mCurPieceNo > 0) and not ((mCurPieceNo >= cds_params.fieldbyName('BeginPieceNo').AsInteger) and (mCurPieceNo <= cds_params.fieldbyName('endPieceNo').AsInteger)) then
begin
Application.MessageBox('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õķ<C3B5>Χ<EFBFBD><CEA7>!', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
Exit;
end;
end;
if trim(cds_params.fieldbyName('dabao').AsString) = '<27><>' then
begin
if strtointdef(edtPacketNo.Text, 0) = 0 then
raise Exception.create('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
if (cds_params.fieldbyName('packRolls').AsInteger = 0) and (trim(cds_params.fieldbyName('packNoMake').AsString) = '<27>Զ<EFBFBD>') then
raise Exception.create('ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>!');
end;
if (strtointdef(PieceNo.Text, 0) = 0) and (trim(cds_params.fieldbyName('rollNoMake').AsString) = '<27>ֶ<EFBFBD>') then
raise Exception.create('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
if trim(lblLenUnit.CaptionOptions.Hint) = '' 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 (strtofloatdef(trim(InputLen.Text), 0) = 0) and (strtofloatdef(trim(InputWeight.Text), 0) = 0) and (strtofloatdef(trim(Edit_fixLen.Text), 0) = 0) then
raise Exception.create('<27><><EFBFBD>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>Ϊ0!!');
end;
Result := true;
except
Application.MessageBox(pchar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmMachRollMain.ClearGlobal();
begin
FBCIOID := '';
FOrderNo := '';
FConNo := '';
FConMId := '';
FConSId := '';
FMainId := '';
FSubId := '';
FPCId := '';
FC_CustPattern := '';
FC_ColorDepth := '';
FFtyPCId := '';
FGangNo := '';
FC_Code := '';
FC_Name := '';
FBatchNO := '';
FC_Spec := '';
FC_Color := '';
FC_ColorNo := '';
FC_EColor := '';
FC_StyleNo := '';
FC_Composition := '';
FC_Width := '';
FC_GramWeight := '';
FC_Pattern := '';
FCIID := '';
FWorkshop := '';
InputLen.Text := '';
Coefficient.Text := '';
AOrdDefNote1.Text := '';
Tare.Text := '';
InputWeight.Text := '';
FLenUnit := '';
BatchNO.Text := '';
Faddwet := 0;
faddlen := 0;
FPacketCIID := '';
FPacketCount := 0;
end;
procedure TfrmMachRollMain.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 TfrmMachRollMain.InitPlan(MSubID: string);
begin
with ADOQueryBaseTemp do
begin
Close;
SQL.Clear;
SQL.Add('EXEC P_Trade_Insp_Get_plan @SubID=''' + trim(MSubID) + '''');
Open;
if not IsEmpty then
begin
getPlanImage(trim(MSubID));
// InitImage(Trim(ADOTmp.fieldbyname('YFTPName').AsString));
// InitImageHX(Trim(ADOTmp.fieldbyname('HXSID').AsString));
FBCIOID := trim(MSubID);
FLenUnit := trim(ADOQueryBaseTemp.fieldbyName('ruleLenUnit').AsString);
if FLenUnit = '' then
begin
FLenUnit := 'M';
end;
fLabPackage := trim(ADOQueryBaseTemp.fieldbyName('LabPackage').AsString);
fLabVolume := trim(ADOQueryBaseTemp.fieldbyName('LabVolume').AsString);
if (FLenUnit = '') then
begin
ShowMessage('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>ó<EFBFBD><C3B3>ȵ<EFBFBD>λ!');
end;
SetUnit(FLenUnit);
// <20>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õij<C3B5><C4B3>ȵ<EFBFBD>λ <20><>û<EFBFBD><C3BB><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD>ֵ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD>һ<EFBFBD><D2BB>
// if Trim(ADOTmp.fieldbyname('CDUnit').AsString) = '' then
FCDUnit := lblLenUnit.CaptionOptions.Hint;
// else
// FCDUnit := Trim(ADOTmp.fieldbyname('ordUnit').AsString);
FConMId := trim(fieldbyName('ConMId').AsString);
FConSId := trim(fieldbyName('ConSId').AsString);
FConNo := trim(fieldbyName('ConNo').AsString);
FOrderNo := trim(fieldbyName('OrderNo').AsString);
fBuyConNo := trim(fieldbyName('BuyConNo').AsString);
FMainId := trim(fieldbyName('MainId').AsString);
FSubId := trim(fieldbyName('SubId').AsString);
// FPCId := Trim(ADOTmp.fieldbyname('ToPCId').AsString);
// FC_CustPattern := Trim(ADOTmp.fieldbyname('C_CustPattern').AsString);
// FC_ColorDepth := Trim(ADOTmp.fieldbyname('C_ColorDepth').AsString);
// FWorkshop := Trim(ADOTmp.fieldbyname('Workshop').AsString);
FC_StyleNo := trim(fieldbyName('C_StyleNo').AsString);
FC_Composition := trim(fieldbyName('C_Composition').AsString);
FC_Code := trim(fieldbyName('C_Code').AsString);
FC_Name := trim(fieldbyName('C_Name').AsString);
FC_EName := trim(fieldbyName('C_EName').AsString);
// FBatchNO := Trim(ADOTmp.fieldbyname('BatchNO').AsString);
FC_Spec := trim(fieldbyName('C_Spec').AsString);
FC_Color := trim(fieldbyName('C_Color').AsString);
FC_ColorNo := trim(fieldbyName('C_ColorNo').AsString);
FC_EColor := trim(fieldbyName('C_EColor').AsString);
FC_Width := trim(fieldbyName('C_Width').AsString);
FC_GramWeight := trim(fieldbyName('C_GramWeight').AsString);
C_width.Text := FC_Width;
C_GramWeight.Text := FC_GramWeight;
FC_Pattern := trim(fieldbyName('C_Pattern').AsString);
C_Pattern.Text := trim(fieldbyName('C_Pattern').AsString);
customStrField1.Text := trim(fieldbyName('PO').AsString);
// FFtyPCId := trim(fieldbyName('FtyPCId').AsString);
FRulePieceNo := trim(fieldbyName('RulePieceNo').AsString);
FRulePackNo := trim(fieldbyName('RulePackNo').AsString);
//<2F><><EFBFBD><EFBFBD>
Faddwet := fieldbyName('RuleAddwet').AsFloat;
//<2F>ӳ<EFBFBD>
faddlen := fieldbyName('RuleAddLen').AsFloat;
addwet.text := floatTostr(Faddwet);
addLen.text := floatTostr(fAddLen);
fAddwetVirtual := fieldbyName('RuleAddwetVirtual').AsFloat;
fAddLenVirtual := fieldbyName('RuleAddLenVirtual').AsFloat;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>
if (FRulePieceNo = '<27>ֶ<EFBFBD>') or (FRulePieceNo = '<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>') then
begin
cds_params.edit;
cds_params.fieldbyName('rollNoMake').value := '<27>ֶ<EFBFBD>';
cds_params.Post;
dxLayoutItem_roll.Visible := true;
PieceNo.Text := '';
end;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>
if (trim(fieldbyName('RulePackNo').AsString) = '<27>ֶ<EFBFBD>') or (trim(fieldbyName('RulePackNo').AsString) = '<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>') then
begin
cds_params.edit;
cds_params.fieldbyName('packNoMake').value := '<27>ֶ<EFBFBD>';
cds_params.Post;
dxLayoutItem_packno.Visible := true;
// edtPacketNo.Text := '';
end;
// ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cds_params.edit;
cds_params.fieldbyName('packRolls').value := fieldbyName('packRolls').AsInteger;
cds_params.fieldbyName('packlabnumber').value := fieldbyName('packlabnumber').AsInteger;
cds_params.fieldbyName('packPostAction').value := trim(fieldbyName('packPostAction').AsString);
if (fieldbyName('packRolls').AsInteger > 0) and (trim(fieldbyName('RulePackNo').AsString) <> '') then
begin
cds_params.fieldbyName('dabao').value := '<27><>';
end
else
begin
cds_params.fieldbyName('dabao').value := '';
end;
// if fieldbyName('DecimalY').AsInteger > 0 then
// cds_params.fieldbyName('Yplace').value := fieldbyName('DecimalY').AsInteger;
// if fieldbyName('DecimalM').AsInteger > 0 then
// cds_params.fieldbyName('MPlace').value := fieldbyName('DecimalM').AsInteger;
// if fieldbyName('DecimalKg').AsInteger > 0 then
// cds_params.fieldbyName('kgPlace').value := fieldbyName('DecimalKg').AsInteger;
if ADOQueryBaseTemp.fieldbyName('DecimalY').AsInteger >= 0 then
cds_params.fieldbyName('Yplace').value := ADOQueryBaseTemp.fieldbyName('DecimalY').AsInteger;
if ADOQueryBaseTemp.fieldbyName('DecimalM').AsInteger >= 0 then
cds_params.fieldbyName('MPlace').value := ADOQueryBaseTemp.fieldbyName('DecimalM').AsInteger;
if ADOQueryBaseTemp.fieldbyName('DecimalKg').AsInteger >= 0 then
cds_params.fieldbyName('kgPlace').value := ADOQueryBaseTemp.fieldbyName('DecimalKg').AsInteger;
//
cds_params.fieldbyName('outPage').value := '<27><>';
cds_params.fieldbyName('dabao').value := '<27><>';
cds_params.fieldByName('packlabNumber').Value := '1';
cds_params.Post;
//
// BatchNO.Text := trim(fieldbyName('batchNo').AsString);
Coefficient.Text := trim(fieldbyName('Coefficient').AsString);
// ת<><D7AA>ϵ<EFBFBD><CFB5>
lblRuleConversion.ItemIndex := lblRuleConversion.Properties.Items.IndexOf(fieldbyName('RuleConversion').AsString);
OrderNo.Text := FOrderNo;
CodeName.Text := FC_Name;
ColorNo.Text := FC_ColorNo;
Color.Text := FC_Color;
FtyPCId.Text := FFtyPCId;
BCIOID.Text := FBCIOID;
C_StyleNo.Text := FC_StyleNo;
Piece.Text := trim(fieldbyName('ordPiece').AsString);
Qty.Text := trim(fieldbyName('ordQty').AsString) + trim(fieldbyName('ordUnit').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;
packnote.Lines.Add('<27><>װҪ<D7B0><D2AA><EFBFBD><EFBFBD>');
packnote.Lines.Add(trim(fieldbyName('packnote').AsString));
packnote.Lines.Add('<27><>ע<EFBFBD><D7A2>');
packnote.Lines.Add(trim(fieldbyName('ordnote').AsString));
// <20><><EFBFBD><EFBFBD> dxLayoutItem_pieceorder
if StrToFloatDef(fieldbyName('FixedLength').AsString, 0) > 0 then
begin
dxLayoutItem_fixlen.Visible := true;
// Edit_fixLen.Text := '<27><>';
Edit_fixLen.Text := trim(fieldbyName('FixedLength').AsString);
end
else
begin
dxLayoutItem_fixlen.Visible := false;
Edit_fixLen.Text := '';
end;
InputLen.SetFocus;
setFocusCtrol(InputLen.Name);
SetDdetails();
end
else
begin
// ClearGlobal();
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ');
end;
end;
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add(' select DISTINCT FtyPCId from BS_Cloth_IO A where A.IOFlag=''<27><><EFBFBD><EFBFBD>'' and A.IOType='<><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
sql.Add(' and isnull(stkName,'''')='<>ײ<EFBFBD>ƥ''');
sql.Add('and tosubid=(select ordsid from Trade_Plan_sub E WHERE E.SUBID=' + QuotedStr(TRIM(FSUBID)));
SQL.Add(')');
open;
end;
// FtyPCId.Clear;
// while not ADOQueryBaseCmd.Eof do
// begin
// FtyPCId.Items.Add(ADOQueryBaseCmd.FieldByName('FtyPCId').AsString);
// ADOQueryBaseCmd.Next;
// end;
// FtyPCId.ItemIndex := 0;
InitJYGrid();
InitCDGrid(FCIID);
edtScan.Text := '';
// <20><>ʾ<EFBFBD><CABE>
setFormCtrol();
end;
procedure TfrmMachRollMain.InputLenKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, true, true);
end;
end;
procedure TfrmMachRollMain.InputLenPropertiesChange(Sender: TObject);
begin
// if StrToIntDef(trim(InputWeight.Text), 0) = 0 then
// begin
// exit;
// end;
QuantityConversion();
end;
procedure TfrmMachRollMain.labNumberChange(Sender: TObject);
begin
inherited;
if not cds_params.IsEmpty then
begin
cds_params.Edit;
with cds_params do
begin
cds_params.fieldByName('labNumber').Value := StrToIntDef(labNumber.Text, 1);
end;
cds_params.Post;
end;
end;
procedure TfrmMachRollMain.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 TfrmMachRollMain.SetUnit(MUnit: string);
begin
// lblLenUnit.Caption := MUnit;
lblLenUnit.CaptionOptions.Hint := MUnit;
lblLenUnit.CaptionOptions.Text := '[B][SIZE=16]' + MUnit + '[/SIZE][/B]';
// lblLenUnit1.Caption := MUnit;
frameBads1.lblLenUnit1.Caption := MUnit;
end;
procedure TfrmMachRollMain.SpeedButton1Click(Sender: TObject);
var
fsj: string;
mComponent: TComponent;
begin
fsj := trim(TSpeedButton(Sender).Hint);
if trim(fsj) = '' then
exit;
mComponent := FindComponent(trim(TSpeedButton(Sender).Hint));
if mComponent = nil then
mComponent := frameBads1.FindComponent(trim(TSpeedButton(Sender).Hint));
if mComponent = nil then
exit;
if TcxTextEdit(mComponent).Name = 'KuangHao' then
exit;
fsj := trim(TcxTextEdit(mComponent).Text);
TcxTextEdit(mComponent).Text := fsj + trim(TSpeedButton(Sender).Caption);
TcxTextEdit(mComponent).SelectAll;
end;
procedure TfrmMachRollMain.SpeedButton_backClick(Sender: TObject);
var
fsj: string;
mComponent: TComponent;
begin
mComponent := FindComponent(trim(TSpeedButton(Sender).Hint));
if mComponent = nil then
mComponent := frameBads1.FindComponent(trim(TSpeedButton(Sender).Hint));
if mComponent = nil then
exit;
fsj := trim(TcxTextEdit(mComponent).Text);
if trim(fsj) = '' then
exit;
TcxTextEdit(mComponent).Text := copy(fsj, 1, Length(fsj) - 1);
TcxTextEdit(mComponent).SelectAll;
end;
procedure TfrmMachRollMain.ToolButton1Click(Sender: TObject);
var
MPacketId, FCXPacketCIID: string;
begin
if (trim(cds_params.fieldbyName('dabao').AsString) <> '<27><>') then
exit;
try
packPostBtn.Enabled := false;
FCXPacketCIID := '';
with CDS_3 do
begin
First;
while not Eof do
begin
if CDS_3.FieldByName('ssel').AsBoolean = True then
begin
FCXPacketCIID := FCXPacketCIID + ',' + trim(cds_3.fieldbyName('CIID').AsString);
end;
Next;
end;
if GetLSNo(ADOQueryBaseTemp, MPacketId, 'BI', 'Trade_Cloth_Inspect', 4, 1) = false then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
exit;
end;
end;
try
ADOQueryBaseCmd.Connection.BeginTrans;
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('Update Trade_Cloth_Inspect Set PacketTime=GETDATE() , PacketNo=' + trim(edtPacketNo.Text) + ',PacketId=' + QuotedStr(trim(MPacketId)) + ',PacketCode=' + QuotedStr(trim(DCode)) + ',PacketName=' + QuotedStr(trim(DName)));
SQL.Add('WHERE EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + QuotedStr(FCXPacketCIID) + ','','') X where Trade_Cloth_Inspect.CIID=X.RTValue ) ');
SQL.Add('Update Trade_Cloth_Stock Set PacketTime=GETDATE() , PacketNo=' + trim(edtPacketNo.Text) + ',PacketId=' + QuotedStr(trim(MPacketId)) + ',PacketCode=' + QuotedStr(trim(DCode)) + ',PacketName=' + QuotedStr(trim(DName)));
SQL.Add('WHERE EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + QuotedStr(FCXPacketCIID) + ','','') X where Trade_Cloth_Stock.CIID=X.RTValue ) ');
// showmessage(SQL.text);
ExecSQL;
end;
if (cds_params.fieldbyName('packlabnumber').AsInteger > 0) then
PrintBao(MPacketId);
// edtPacketNo.Text := inttostr(strtoint(edtPacketNo.Text) + 1);
GetRulePacketNo();
FPacketCIID := '';
FPacketCount := 0;
ADOQueryBaseCmd.Connection.CommitTrans;
//
if fileexists(ExtractFilePath(Application.ExeName) + '<27><>ȷ.wav') then
playSound(pwidechar('<27><>ȷ.wav'), 0, SND_FILENAME or SND_ASYNC);
except
ADOQueryBaseCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
finally
InitJYGrid();
packPostBtn.Enabled := true;
end;
end;
procedure TfrmMachRollMain.ToolButton2Click(Sender: TObject);
var
cxPacketCIID: string;
begin
if CDS_3.IsEmpty then
Exit;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
with CDS_3 do
begin
First;
while not Eof do
begin
if CDS_3.FieldByName('ssel').AsBoolean = True then
begin
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('Update Trade_Cloth_Inspect Set PacketTime=null, PacketNo=null,PacketId=null,PacketCode=null,PacketName=null ');
SQL.Add('WHERE CIID=' + QuotedStr(trim(cds_3.fieldbyName('CIID').AsString)));
SQL.Add('Update Trade_Cloth_Stock Set PacketTime=null, PacketNo=null,PacketId=null,PacketCode=null,PacketName=null ');
SQL.Add('WHERE CIID=' + QuotedStr(trim(cds_3.fieldbyName('CIID').AsString)));
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) + ') ');
// showmessage(sql.text);
execsql;
end;
end;
Next;
end;
end;
InitJYGrid();
end;
procedure TfrmMachRollMain.ToolButton3Click(Sender: TObject);
begin
if cds_3.IsEmpty then
exit;
PrtData(cds_3.fieldbyName('CIID').AsString);
end;
procedure TfrmMachRollMain.ToolButton4Click(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.create(Application);
with frmZDYHelp do
begin
ToolButton1.Visible := false;
DConString := Self.ADOQueryBaseCmd.Connection.ConnectionString;
flag := 'WFBCD';
flagname := '<27>õ<EFBFBD>';
fnote := true;
V1Note.Caption := <><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
Self.frameBads1.InitBadPanel();
end;
end;
finally
frmZDYHelp.free;
end;
end;
procedure TfrmMachRollMain.TrolldelClick(Sender: TObject);
var
mCiid: string;
begin
if cds_3.IsEmpty then
exit;
// if Trim(cds_3.FieldByName('packetid').AsString) <> '' then
// begin
// if Application.MessageBox(pchar('ȷ<><C8B7>Ҫɾ<D2AA><C9BE>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + Trim(cds_3.FieldByName('packetNo').AsString) + '<27><><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'), '<27><>ʾ', 32 + 4) <> IDYES then
// exit;
// deletePack(Trim(cds_3.FieldByName('packetid').AsString));
// exit;
// end
// else
// begin
// if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE>ѡ<EFBFBD><D1A1><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
// exit;
// end;
ADOQueryBaseCmd.Connection.BeginTrans;
try
mCiid := trim(cds_3.fieldbyName('CIID').AsString);
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(mCiid) + ',' + QuotedStr(DName) + ') ');
ExecSQL;
end;
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('exec P_Trade_Insp_Del ');
SQL.Add('@CIIDS=' + QuotedStr(mCiid));
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;
if (FPacketCount > 0) and (ansipos(mCiid, FPacketCIID) > 0) then
begin
FPacketCount := FPacketCount - 1;
FPacketCIID := FPacketCIID.Replace(mCiid, '');
if FPacketCIID = ',' then
FPacketCIID := '';
end;
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 TfrmMachRollMain.Tv2DblClick(Sender: TObject);
begin
inherited;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ü<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', 1) = 2 then
exit;
CDS_2.Delete;
end;
procedure TfrmMachRollMain.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;
if AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('Bstatus').Index] > 0 then
ACanvas.Brush.Color := clRed;
end;
procedure TfrmMachRollMain.Tv3FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
begin
inherited;
InitCDGridCX(cds_3.fieldbyName('CIID').AsString);
end;
procedure TfrmMachRollMain.TeditClick(Sender: TObject);
begin
if cds_3.IsEmpty then
exit;
InitJTM(cds_3.fieldbyName('CIID').AsString);
initEditPiece();
end;
procedure TfrmMachRollMain.TlogClick(Sender: TObject);
begin
frmSysLogList := TfrmSysLogList.create(Self);
with frmSysLogList do
begin
fModel := Self.Caption;
FMainId := trim(Self.FMainId);
ShowModal;
free;
end;
end;
procedure TfrmMachRollMain.ToolButton7Click(Sender: TObject);
begin
WriteCxGrid(trim(Self.Caption) + 'Tv1', TV1, gDllFileCaption);
WriteCxGrid(trim(Self.Caption) + 'Tv2', Tv2, gDllFileCaption);
WriteCxGrid(trim(Self.Caption) + 'Tv3', Tv3, gDllFileCaption);
if gIsCanDesign then
begin
saveLayOut(application, dxLayoutControl_pack, ADOQueryBaseCmd, PWideChar(fDllFileName + '|' + Self.Name + '|' + dxLayoutControl_pack.Name + '.ini'));
end;
end;
procedure TfrmMachRollMain.ToolButton8Click(Sender: TObject);
begin
inherited;
Close;
end;
procedure TfrmMachRollMain.TprintPackClick(Sender: TObject);
begin
if cds_3.IsEmpty or (trim(cds_3.fieldbyName('PacketId').AsString) = '') then
exit;
PrintBao(trim(cds_3.fieldbyName('PacketId').AsString));
end;
procedure TfrmMachRollMain.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 TfrmMachRollMain.CIFEndChange(Sender: TObject);
var
mvalue: double;
begin
if trim(frameBads1.CIFBeg.Text) <> '' then
begin
if TryStrToFloat(frameBads1.CIFBeg.Text, mvalue) = false then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
exit;
end;
end
else
begin
exit;
end;
if trim(frameBads1.CIFEnd.Text) <> '' then
begin
if TryStrToFloat(frameBads1.CIFEnd.Text, mvalue) = false then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
exit;
end;
end
else
begin
exit;
end;
frameBads1.CIFQty.Text := floattostr(StrToFloat(frameBads1.CIFEnd.Text) - StrToFloat(frameBads1.CIFBeg.Text));
end;
procedure TfrmMachRollMain.SetDdetails();
begin
AOrdDefNote1.Text := '';
if fBuyConNo <> '' then
AOrdDefNote1.Text := AOrdDefNote1.Text + '<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>:' + fBuyConNo + #13;
AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><><EFBFBD><EFBFBD>:' + FBCIOID + #13;
if FC_EName <> '' then
AOrdDefNote1.Text := AOrdDefNote1.Text + 'Ʒ<><C6B7>:' + FC_Name + '(' + FC_EName + ')' + #13
else
AOrdDefNote1.Text := AOrdDefNote1.Text + 'Ʒ<><C6B7>:' + FC_Name + #13;
AOrdDefNote1.Text := AOrdDefNote1.Text + '<27>ŷ<EFBFBD>:' + FC_Width + ' <20><><EFBFBD><EFBFBD>:' + FC_GramWeight + #13;
// AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><><EFBFBD><EFBFBD>:' + FC_GramWeight + #13;
// AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><>ɫ:' + FC_Color + ' ɫ<><C9AB>:' + FC_ColorNo + #13;
// AOrdDefNote1.Text := AOrdDefNote1.Text + 'ɫ<><C9AB>:' + FC_ColorNo + #13;
if FC_StyleNo <> '' then
AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><><EFBFBD><EFBFBD>:' + FC_StyleNo + #13;
if abs(Faddwet) > 0 then
begin
AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><><EFBFBD><EFBFBD>:' + FC_Pattern + ' <20><><EFBFBD><EFBFBD>:' + floattostr(Faddwet) + #13;
end
else if abs(faddlen) > 0 then
begin
AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><><EFBFBD><EFBFBD>:' + FC_Pattern + ' <20>ӳ<EFBFBD>:' + floattostr(faddlen) + #13;
end
else
begin
if FC_Pattern <> '' then
AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><><EFBFBD><EFBFBD>:' + FC_Pattern + #13;
end;
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 TfrmMachRollMain.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 TfrmMachRollMain.setFormCtrol();
begin
if cds_params.fieldbyName('dabao').AsString = '<27><>' then
begin
dxLayoutItem_packno.Visible := true;
Tv3PacketNo.Visible := true;
//
if (trim(cds_params.fieldbyName('packPostAction').AsString) <> '<27>Զ<EFBFBD>') then
begin
dxLayoutItem_packpost.Visible := true;
end
else
dxLayoutItem_packpost.Visible := false;
//
// if cds_3.IsEmpty then
// edtPacketNo.Text := '1'
// else
// GetPacketNo();
GetRulePacketNo();
end
else
begin
dxLayoutItem_packno.Visible := false;
Tv3PacketNo.Visible := false;
dxLayoutItem_packpost.Visible := false;
edtPacketNo.Text := '';
end;
//
if cds_params.fieldbyName('weightRule').AsInteger = 0 then
dxLayoutItem_outweight.Caption := '[COLOR=Red][SIZE=18]<5D><><EFBFBD><EFBFBD>[/COLOR][/SIZE]'
else
dxLayoutItem_outweight.Caption := '[COLOR=Red][SIZE=18]ë<><C3AB>[/COLOR][/SIZE]';
if cds_params.fieldbyName('rollnoMake').AsString = '<27>ֶ<EFBFBD>' then
begin
// PieceNo.Enabled:=true;
PieceNo.Properties.ReadOnly := false;
if cds_params.fieldbyName('BeginPieceNo').AsInteger > 0 then
begin
PieceNo.Text := cds_params.fieldbyName('BeginPieceNo').AsString;
end;
// <20><><EFBFBD><EFBFBD>
if (cds_params.fieldbyName('EndPieceNo').AsInteger > 0) and (cds_params.fieldbyName('BeginPieceNo').AsInteger > cds_params.fieldbyName('EndPieceNo').AsInteger) then
begin
dxLayoutItem_pieceorder.Visible := true;
Edit_pieceOrder.Text := '<27><>';
end;
end
else
begin
PieceNo.Properties.ReadOnly := true;
// PieceNo.Enabled:=False;
end;
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 TfrmMachRollMain.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 TfrmMachRollMain.InitCDGrid(MCIID: string);
begin
cxPageControl1.ActivePageIndex := 0;
try
CDS_2.DisableControls;
with ADOQueryBaseTemp do
begin
Close;
SQL.Clear;
SQL.Add('select * from Trade_Cloth_Inspect_Flaw where CIID=' + QuotedStr(trim(MCIID)));
Open;
end;
SCreateCDS(ADOQueryBaseTemp, CDS_2);
SInitCDSData(ADOQueryBaseTemp, CDS_2);
finally
CDS_2.EnableControls;
end;
end;
procedure TfrmMachRollMain.InitCDGridCX(MCIID: string);
begin
cxPageControl1.ActivePageIndex := 1;
with ADOQueryBaseTemp do
begin
Close;
SQL.Clear;
SQL.Add('select * from Trade_Cloth_Inspect_Flaw where CIID=' + QuotedStr(trim(MCIID)));
Open;
end;
SCreateCDS(ADOQueryBaseTemp, cds_1);
SInitCDSData(ADOQueryBaseTemp, cds_1);
end;
procedure TfrmMachRollMain.InitJYGrid();
var
MNetWeight, MJYLen: double;
begin
try
cds_3.DisableControls;
with ADOQueryMain do
begin
Close;
SQL.Clear;
SQL.Add('select A.*,Bstatus=(case when isnull(PacketNo,0)>0 then 1 else 0 end)');
SQL.Add('from Trade_Cloth_Inspect A where BCIOID=''' + trim(FBCIOID) + '''');
SQL.Add('order by filltime desc');
Open;
end;
SCreateCDS(ADOQueryMain, cds_3);
SInitCDSData(ADOQueryMain, cds_3);
// if not cds_3.IsEmpty then
// begin
// cds_3.First;
// PieceNo.Text := trim(cds_3.FieldByName('PieceNo').AsString); //
// end
// else
// PieceNo.Text := '';
finally
cds_3.EnableControls;
end;
end;
procedure TfrmMachRollMain.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 TfrmMachRollMain.packPostBtnClick(Sender: TObject);
var
MPacketId: string;
begin
if (trim(cds_params.fieldbyName('dabao').AsString) <> '<27><>') then
exit;
try
packPostBtn.Enabled := false;
if FPacketCount = 0 then
begin
Application.MessageBox('<27><>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>', '<27><>ʾ', 0);
exit;
end;
with ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('select isnull(count(*),0) as js from Trade_Cloth_Inspect where PacketNo=''' + trim(edtPacketNo.Text) + ''' and mainid=''' + trim(Fmainid) + ''' ');
open;
end;
if ADOQuery1.fieldbyName('JS').AsInteger = 1 then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if FPacketCount > 0 then
begin
if GetLSNo(ADOQueryBaseTemp, MPacketId, 'BI', 'Trade_Cloth_Inspect', 4, 1) = false then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
exit;
end;
try
ADOQueryBaseCmd.Connection.BeginTrans;
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('Update Trade_Cloth_Inspect Set PacketTime=GETDATE() , PacketNo=' + trim(edtPacketNo.Text) + ',PacketId=' + QuotedStr(trim(MPacketId)) + ',PacketCode=' + QuotedStr(trim(DCode)) + ',PacketName=' + QuotedStr(trim(DName)));
SQL.Add('WHERE EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + QuotedStr(FPacketCIID) + ','','') X where Trade_Cloth_Inspect.CIID=X.RTValue ) ');
SQL.Add('Update Trade_Cloth_Stock Set PacketTime=GETDATE() , PacketNo=' + trim(edtPacketNo.Text) + ',PacketId=' + QuotedStr(trim(MPacketId)) + ',PacketCode=' + QuotedStr(trim(DCode)) + ',PacketName=' + QuotedStr(trim(DName)));
SQL.Add('WHERE EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + QuotedStr(FPacketCIID) + ','','') X where Trade_Cloth_Stock.STKID=X.RTValue ) ');
ExecSQL;
end;
if (cds_params.fieldbyName('packlabnumber').AsInteger > 0) then
PrintBao(MPacketId);
// edtPacketNo.Text := inttostr(strtoint(edtPacketNo.Text) + 1);
GetRulePacketNo();
FPacketCIID := '';
FPacketCount := 0;
ADOQueryBaseCmd.Connection.CommitTrans;
//
if fileexists(ExtractFilePath(Application.ExeName) + '<27><>ȷ.wav') then
playSound(pwidechar('<27><>ȷ.wav'), 0, SND_FILENAME or SND_ASYNC);
except
ADOQueryBaseCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
finally
InitJYGrid();
packPostBtn.Enabled := true;
end;
end;
procedure TfrmMachRollMain.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 TfrmMachRollMain.cxButton2Click(Sender: TObject);
begin
inherited;
if FCIFName = '' then
begin
frameBads1.dxPanel1.Visible := false;
exit;
end;
with CDS_2 do
begin
Append;
// if RadioGroup1.ItemIndex = 5 then
// FieldByName('CIFName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + Trim(FCIFName)
// else if RadioGroup1.ItemIndex = 4 then
// FieldByName('CIFName').Value := '<27><>ƥ' + Trim(FCIFName)
// else
fieldbyName('CIFName').value := trim(FCIFName);
fieldbyName('CIFbeg').value := trim(frameBads1.CIFBeg.Text);
fieldbyName('CIFEnd').value := trim(frameBads1.CIFEnd.Text);
fieldbyName('CIFNumber').value := strtointdef(trim(frameBads1.CIFNumber.Text), 0);
fieldbyName('CIFPoints').value := 0;
if frameBads1.RadioGroup1.ItemIndex > -1 then
begin
if frameBads1.RadioGroup1.ItemIndex < 3 then
begin
fieldbyName('CIFPoints').value := frameBads1.RadioGroup1.ItemIndex + 1;
end
else
begin
fieldbyName('CIFPoints').value := 4;
end;
end;
fieldbyName('CIFQty').value := strtofloatdef(trim(frameBads1.CIFQty.Text), 0);
fieldbyName('SubtractQty').value := strtofloatdef(trim(frameBads1.SubtractQty.Text), 0);
fieldbyName('IsSubtract').value := frameBads1.IsSubtract.Checked;
Post;
end;
frameBads1.CIFBeg.Text := '';
frameBads1.CIFEnd.Text := '';
frameBads1.CIFQty.Text := '';
frameBads1.dxPanel1.Visible := false;
cxPageControl1.ActivePageIndex := 0;
end;
procedure TfrmMachRollMain.edtChenClick(Sender: TObject);
begin
inherited;
if trim(edtChen.Text) = '' then
begin
edtChen.Text := '<27><>';
end
else
begin
edtChen.Text := '';
end;
// if not cds_params.IsEmpty then
// begin
cds_params.Edit;
with cds_params do
begin
if Trim(edtChen.Text) = '<27><>' then
cds_params.fieldByName('chen').Value := '1'
else
cds_params.fieldByName('chen').Value := '0';
end;
cds_params.Post;
// end;
end;
procedure TfrmMachRollMain.outPageClick(Sender: TObject);
begin
inherited;
if trim(outPage.Text) = '' then
begin
outPage.Text := '<27><>';
end
else
begin
outPage.Text := '';
end;
// if not cds_params.IsEmpty then
// begin
cds_params.Edit;
with cds_params do
begin
// <20><>ֽ
cds_params.fieldByName('outPage').Value := outPage.Text;
end;
cds_params.Post;
// end;
end;
procedure TfrmMachRollMain.dxLayoutControl_packDblClick(Sender: TObject);
begin
if gIsCanDesign then
layoutDesign(TdxLayoutControl(Sender), ADOQueryBaseCmd, PWideChar(dcode));
end;
procedure TfrmMachRollMain.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;
end;
procedure TfrmMachRollMain.Edit_fixLenClick(Sender: TObject);
begin
inherited;
// if trim(Edit_fixLen.Text) = '' then
// begin
// Edit_fixLen.Text := '<27><>';
// end
// else
// begin
// Edit_fixLen.Text := '';
// end;
end;
procedure TfrmMachRollMain.edtMaBiaoClick(Sender: TObject);
begin
inherited;
if trim(edtMaBiao.Text) = '' then
begin
edtMaBiao.Text := '<27><>';
end
else
begin
edtMaBiao.Text := '';
end;
// if not cds_params.IsEmpty then
// begin
cds_params.Edit;
with cds_params do
begin
if Trim(edtMaBiao.Text) = '<27><>' then
cds_params.fieldByName('mabiao').Value := '1'
else
cds_params.fieldByName('mabiao').Value := '0';
end;
cds_params.Post;
// end;
end;
procedure TfrmMachRollMain.Edit_pieceOrderClick(Sender: TObject);
begin
inherited;
if trim(Edit_pieceOrder.Text) = '' then
begin
Edit_pieceOrder.Text := '<27><>';
end
else
begin
Edit_pieceOrder.Text := '';
end;
end;
procedure TfrmMachRollMain.edtScanDblClick(Sender: TObject);
begin
inherited;
edtScan.Text := '';
end;
procedure TfrmMachRollMain.edtScanEnter(Sender: TObject);
begin
inherited;
setFocusCtrol(TWinControl(Sender).Name);
end;
procedure TfrmMachRollMain.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();
FOperationStatus := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
// InitLCK(edtScan.Text);
InitPlan(edtScan.Text);
frameBads1cxCheckBox_readLenPropertiesChange(frameBads1.IsSubtract);
// <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȹ<EFBFBD>ѡ
if trim(OrderNo.Text) <> '' then
InputLen.SetFocus;
cxGroupBox_keys.Visible := false;
end;
end;
//
function TfrmMachRollMain.SaveData(): Boolean;
var
maxno, MCIID, BZID, strsql, maxPlateid: string;
MInputLen, MMeter, MYardage: double;
MInputWeight, MGrossWeight, MNetWeight, MTare, Maddwet, maddLen: double;
mYardStick: double;
mPresentLen, mpresentWeight: double;
begin
Result := false;
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;
if FOperationStatus = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
MCIID := FCIID;
end
else
begin
MCIID := '';
end;
try
ADOQueryBaseCmd.Connection.BeginTrans;
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('select * from Trade_Cloth_Inspect where CIID=''' + trim(MCIID) + '''');
Open;
end;
with ADOQueryBaseCmd do
begin
if trim(MCIID) = '' then
begin
if not GetLSNo(ADOQueryBaseTemp, maxno, trim(SCXFlag), 'Trade_Cloth_Inspect', 4, 1) then
raise Exception.create('<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
Append;
fieldbyName('Filler').value := trim(DName);
fieldbyName('CIID').value := trim(maxno);
end
else
begin
maxno := trim(MCIID);
edit;
fieldbyName('Editer').value := trim(DName);
fieldbyName('EditTime').value := SGetServerDateTime(ADOQueryBaseTemp);
end;
// ϵ<><CFB5>
fieldbyName('Coefficient').value := strtofloatdef(trim(Coefficient.Text), 0); // ϵ<><CFB5>
/// ////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /////////////////////////
if cds_params.fieldbyName('weightRule').AsInteger = 0 then
// InputWeight ë<><C3AB> OutPutWeight <20><><EFBFBD><EFBFBD>
begin
MTare := strtofloatdef(trim(Tare.Text), 0); // Ƥ<><C6A4>
MInputWeight := RoundFloat(strtofloatdef(trim(InputWeight.Text), 0), cds_params.fieldbyName('KgPlace').AsInteger); //<2F><><EFBFBD><EFBFBD>Ϊ ë<><C3AB>
MGrossWeight := MInputWeight + Maddwet + mpresentWeight; // ë<><C3AB> + <20><><EFBFBD><EFBFBD>
// MNetWeight := MInputWeight + Maddwet - MTare; // <20><><EFBFBD><EFBFBD> + <20><><EFBFBD><EFBFBD>
// MGrossWeight := MInputWeight + Maddwet + mpresentWeight; // ë<><C3AB> + <20><><EFBFBD><EFBFBD>
MNetWeight := MInputWeight + Maddwet - MTare + mpresentWeight; // <20><><EFBFBD><EFBFBD> + <20><><EFBFBD><EFBFBD>
fieldbyName('InputWeight').value := MInputWeight;
// <20><><EFBFBD><EFBFBD>
if MInputWeight > 0 then
begin
fieldbyName('NetWeight').value := MNetWeight;
// ë<><C3AB>
fieldbyName('GrossWeight').value := MGrossWeight;
end
else
begin
fieldbyName('NetWeight').value := 0;
fieldbyName('GrossWeight').value := 0;
end;
fieldbyName('Tare').value := MTare;
fieldbyName('addwet').value := Maddwet;
end;
if cds_params.fieldbyName('weightRule').AsInteger = 1 then
// InputWeight <20><><EFBFBD><EFBFBD> OutPutWeight ë<><C3AB>
begin
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; // ë<><C3AB>
MNetWeight := MInputWeight + Maddwet; // <20><><EFBFBD><EFBFBD> +<2B><><EFBFBD><EFBFBD>
// MGrossWeight := MInputWeight + MTare + Maddwet + mpresentWeight; // ë<><C3AB>
// MNetWeight := MInputWeight + Maddwet + mpresentWeight; // <20><><EFBFBD><EFBFBD> +<2B><><EFBFBD><EFBFBD>
fieldbyName('InputWeight').value := MInputWeight;
if MInputWeight > 0 then
begin
fieldbyName('NetWeight').value := MNetWeight;
fieldbyName('GrossWeight').value := MGrossWeight;
end
else
begin
fieldbyName('NetWeight').value := 0;
fieldbyName('GrossWeight').value := 0;
end;
// Ƥ<><C6A4>
fieldbyName('Tare').value := MTare;
fieldbyName('addwet').value := Maddwet;
end;
/// ////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /////////////////////////
///
/// ////////////////////// <20><><EFBFBD><EFBFBD><E6B3A4> /////////////////////////
/// = '<27><>'
if strtofloatdef(trim(Edit_fixLen.Text), 0) > 0 then
MInputLen := strtofloatdef(trim(Edit_fixLen.Text), 0)
else
MInputLen := RoundFloat(strtofloatdef(trim(InputLen.Text), 0), 4);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+mAddLen
if (uppercase(lblLenUnit.CaptionOptions.Hint) = 'M') or (lblLenUnit.CaptionOptions.Hint = '<27><>') then
begin
// MMeter := RoundFloat((MInputLen + maddLen) / (mYardStick / 100), cds_params.fieldbyName('MPlace').AsInteger);
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) / (mYardStick / 100), cds_params.fieldbyName('YPlace').AsInteger);
MMeter := RoundFloat(MYardage * 0.9144, cds_params.fieldbyName('MPlace').AsInteger);
end;
fieldbyName('InputLen').value := RoundFloat(strtofloatdef(trim(InputLen.Text), 0), 2);
fieldbyName('Meter').value := MMeter;
fieldbyName('Yardage').value := MYardage;
fieldbyName('LenUnit').value := trim(lblLenUnit.CaptionOptions.Hint);
fieldbyName('AddLen').value := maddLen;
fieldbyName('YardStick').value := mYardStick;
/// ////////////////////// <20><><EFBFBD><EFBFBD><E6B3A4> /////////////////////////
// if Trim(Edit_zp.Text) <> '' then
// begin
fieldbyName('Grade').value := trim(grade.Text);
// end;
// if Trim(Edit_cp.Text) <> '' then
// begin
// FieldByName('Grade').Value := '<27><>Ʒ';
// end;
if FOperationStatus <> '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
fieldbyName('PieceNo').value := 0;
end;
// <20>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>
if (FRulePieceNo = '<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>') or (FRulePieceNo = '<27>ֶ<EFBFBD>') or (cds_params.fieldbyName('rollnoMake').AsString = '<27>ֶ<EFBFBD>') then
begin
fieldbyName('PieceNo').value := strtoint(trim(PieceNo.Text));
end;
fieldbyName('status').value := '0';
fieldbyName('OrderNo').value := trim(FOrderNo);
fieldbyName('MainId').value := trim(FMainId);
fieldbyName('SubId').value := trim(FSubId);
fieldbyName('ConNo').value := trim(FConNo);
fieldbyName('ConMId').value := trim(FConMId);
fieldbyName('ConSId').value := trim(FConSId);
fieldbyName('BCIOID').value := trim(FBCIOID);
fieldbyName('Workshop').value := trim(FWorkshop);
fieldbyName('CIIOFlag').value := <><CEB4><EFBFBD><EFBFBD>';
// if dxLayoutItem_rk.Visible then
// fieldbyName('CIIOFlag').value := 'δ<><CEB4><EFBFBD><EFBFBD>'
// else
// fieldbyName('CIIOFlag').value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
fieldbyName('C_Code').value := FC_Code;
fieldbyName('C_Name').value := FC_Name;
fieldbyName('C_EName').value := FC_EName;
fieldbyName('BatchNO').value := BatchNO.Text;
fieldbyName('FtyPCId').value := FtyPCId.Text; // ԭ<>׺<EFBFBD>
if strtointdef(Plateno.Text, 0) <> 0 then
begin
fieldbyName('Plateno').value := trim(Plateno.text); //<2F><><EFBFBD><EFBFBD>
end;
fieldbyName('C_Spec').value := FC_Spec;
fieldbyName('C_Color').value := FC_Color;
fieldbyName('C_EColor').value := FC_EColor;
fieldbyName('C_ColorNo').value := FC_ColorNo;
fieldbyName('C_StyleNo').value := FC_StyleNo;
fieldbyName('C_Composition').value := FC_Composition;
if dxLayoutItem_width.ActuallyVisible then
fieldbyName('C_Width').value := trim(C_width.Text)
else
fieldbyName('C_Width').value := FC_Width;
if dxLayoutItem_gram.ActuallyVisible then
fieldbyName('C_GramWeight').value := trim(C_GramWeight.Text)
else
fieldbyName('C_GramWeight').value := FC_GramWeight;
fieldbyName('C_Pattern').value := FC_Pattern;
fieldbyName('C_CustPattern').value := FC_CustPattern;
fieldbyName('C_ColorDepth').value := FC_ColorDepth;
fieldbyName('CIMachNo').value := trim(SCXFlag);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
fieldbyName('AddwetVirtual').value := fAddwetVirtual;
fieldbyName('AddLenVirtual').value := fAddLenVirtual;
fieldbyName('AddwetPresent').value := abs(mpresentWeight);
// cds_params.fieldbyName('AddwetPresent').AsFloat;
fieldbyName('AddLenPresent').value := abs(mPresentLen);
// cds_params.fieldbyName('AddLenPresent').AsFloat;
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1
fieldbyName('customStrField1').value := trim(customStrField1.Text);
fieldbyName('customStrField2').value := trim(customStrField2.Text);
//ƴƥ
if FieldList.FieldByName('unitPieces') <> nil then
fieldbyName('unitPieces').value := funitPiecesStr;
//<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>Ա
if FieldList.FieldByName('operators') <> nil then
fieldbyName('operators').value := gMachOperators;
Post;
end;
if PlateNo.Text <> '' then
begin
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from Trade_Cloth_Inspect where Mainid=''' + FMainId + ''' and isnull(PlateNo,'''')=''' + trim(PlateNo.Text) + ''' ');
sql.Add(' and CIID<>''' + Trim(maxno) + ''' ');
Open;
end;
if ADOTemp.IsEmpty then
begin
if GetLSNo(ADOQuery1, maxPlateid, 'Ban', 'Trade_Cloth_Inspect', 4, 1) = False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
exit;
end;
with ADOCmd do
begin
Close;
sql.clear;
sql.add('update Trade_Cloth_Inspect set Plateid=''' + trim(maxPlateid) + ''' where CIID=''' + Trim(maxno) + ''' ');
ExecSQL;
end;
end
else
begin
with ADOCmd do
begin
Close;
sql.clear;
sql.add('update Trade_Cloth_Inspect set Plateid=''' + trim(ADOTemp.fieldbyname('Plateid').AsString) + ''' where CIID=''' + Trim(maxno) + ''' ');
ExecSQL;
end;
end;
end;
MCIID := trim(maxno);
FCIID := trim(maxno);
/// /////////////// <20><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ϣ //////////////////
with CDS_2 do
begin
First;
while not eof do
begin
if trim(CDS_2.fieldbyName('CIFID').AsString) = '' then
begin
if not GetLSNo(ADOQueryBaseTemp, maxno, 'JC', 'Trade_Cloth_Inspect_Flaw', 5, 1) then
raise Exception.create('<27><>ȡ<EFBFBD>õ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
end
else
begin
maxno := trim(CDS_2.fieldbyName('CIFID').AsString);
end;
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('select * from Trade_Cloth_Inspect_Flaw ');
SQL.Add(' where CIFID=''' + trim(maxno) + '''');
Open;
end;
with ADOQueryBaseCmd do
begin
if trim(CDS_2.fieldbyName('CIFID').AsString) = '' then
Append
else
edit;
RTSetSaveDataCDS(ADOQueryBaseCmd, Tv2, CDS_2, 'Trade_Cloth_Inspect_Flaw', 0);
fieldbyName('CIID').value := trim(MCIID);
fieldbyName('CIFID').value := trim(maxno);
Post;
end;
CDS_2.edit;
CDS_2.fieldbyName('CIID').value := trim(MCIID);
CDS_2.fieldbyName('CIFID').value := trim(maxno);
next;
end;
end;
/// /////////////// <20><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ϣ //////////////////
///
/// /////////////// <20><><EFBFBD>¾<EFBFBD><C2BE>Ŵõ<C5B4><C3B5><EFBFBD>Ϣ //////////////////
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('exec P_Trade_Insp_Up_pack @CIID=''' + trim(MCIID) + '''');
if FOperationStatus = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
SQL.Add(',@InspType=' + QuotedStr('<27><><EFBFBD><EFBFBD><ECB2BC><EFBFBD><EFBFBD>'))
else
SQL.Add(',@InspType=' + QuotedStr('<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>'));
if (cds_params.fieldbyName('rollnoMake').AsString = '<27>ֶ<EFBFBD>') then
begin
SQL.Add(',@RulePieceNo=' + QuotedStr('<27>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>')); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>
end
else
begin
SQL.Add(',@RulePieceNo=' + QuotedStr(FRulePieceNo)); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>
end;
ExecSQL;
end;
//<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ظ<EFBFBD>
if not checkPicecNo() then
begin
exit;
end;
/// /////////////// <20><><EFBFBD>¾<EFBFBD><C2BE>Ŵõ<C5B4><C3B5><EFBFBD>Ϣ //////////////////
///
/// /////////////// <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD> //////////////////
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('insert into Trade_Need_Up(UOperation,UType,UDataId,uoperator) values(''<27><><EFBFBD><EFBFBD>'',''<27><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>'',' + QuotedStr(maxno) + ',' + QuotedStr(DName) + ') ');
ExecSQL;
end;
/// /////////////// <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD> //////////////////
///
ADOQueryBaseCmd.Connection.CommitTrans;
/// /////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2BCB0><EFBFBD><EFBFBD> //////////////////
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('exec P_Trade_Insp_In_Stk @CIID=''' + trim(MCIID) + '''');
// ShowMessage(sql.Text);
ExecSQL;
end;
// Open;
// end;
// if ADOCmd.FieldByName('intReturn').AsInteger = -1 then
// begin
// application.MessageBox(PChar(trim(ADOCmd.FieldByName('ShowMsg').AsString)), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
// Result := False;
// end
// else
// begin
// Result := True;
// end;
/// /////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2BCB0><EFBFBD><EFBFBD> //////////////////
Result := true;
except
ADOQueryBaseCmd.Connection.RollbackTrans;
Application.MessageBox(pchar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
//
procedure TfrmMachRollMain.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_Trade_Print_Lab ');
SQL.Add(' @CIID=''' + trim(MCIID) + '''');
// ShowMessage(SQL.Text);
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 + '.rmf', ADOQueryBaseTemp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + FLabVolume + '.rmf';
// 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();
// if againPring then
// begin
// with ADOQueryBaseCmd do
// begin
// Close;
// SQL.Clear;
// SQL.Add('insert into Trade_Need_Up(UType,UOperation,UDataId,uoperator) values(''<27><><EFBFBD><EFBFBD>'',''<27>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>ǩ'',' + QuotedStr(trim(cds_3.fieldbyName('CIID').AsString)) + ',' + QuotedStr(DName) + ') ');
// ExecSQL;
// end;
// end;
//// self.Close;
// end
// else
// begin
// Application.MessageBox(PChar('û<><C3BB><EFBFBD>ҵ<EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
// end;
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
// if trim(ADOQueryPrint.fieldbyName('LabVolume').AsString) <> '<27><>Ʒ<EFBFBD><C6B7>ǩ' then
RM1.DefaultCopies := cds_params.fieldbyName('labNumber').AsInteger;
// else
// RM1.DefaultCopies := 1;
RM1.PrintReport;
//
if againPring then
begin
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('insert into Trade_Need_Up(UType,UOperation,UDataId,uoperator) values(''<27><><EFBFBD><EFBFBD>'',''<27>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>ǩ'',' + QuotedStr(trim(cds_3.fieldbyName('CIID').AsString)) + ',' + QuotedStr(DName) + ') ');
ExecSQL;
end;
end;
end
else
begin
Application.MessageBox(pchar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
end;
//
procedure TfrmMachRollMain.PrintBao(PPacketId: string; againPring: Boolean = false);
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: Thandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
SQL.Add('exec P_Trade_Insp_Prt_PackLab ' + QuotedStr(PPacketId));
Open;
end;
if trim(ADOQueryPrint.fieldbyName('LabPackage').AsString) <> '' then
fLabPackage := trim(ADOQueryPrint.fieldbyName('LabPackage').AsString)
else
fLabPackage := ADOQueryPrint.fieldbyName('LabPackage').AsString;
ExportFtErpFile(fLabPackage + '.rmf', ADOQueryBaseTemp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + fLabPackage + '.rmf';
// ExportFtErpFile(trim(fLabPackage) + '.fr3', ADOQueryBaseTemp);
// fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + trim(fLabPackage) + '.fr3';
if not FileExists(fPrintFile) then
begin
Application.MessageBox(pchar(<><C3BB><EFBFBD>Ұ<EFBFBD><D2B0><EFBFBD>ǩ' + fPrintFile), '<27><>ʾ', 0);
exit;
end;
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
RM1.DefaultCopies := cds_params.fieldbyName('packlabnumber').AsInteger;
if cds_params.fieldByName('packPrintPreview').AsBoolean then
RM1.ShowReport
else
RM1.PrintReport;
// end;
// if FileExists(fPrintFile) then
// begin
//
// frxReport1.LoadFromFile(fPrintFile);
// frxReport1.PrintOptions.Copies := cds_params.fieldbyName('packlabnumber').AsInteger;
// if cds_params.fieldByName('packPrintPreview').AsBoolean then
// begin
// frxReport1.PrintOptions.ShowDialog := true;
// frxReport1.ShowReport;
// end
// else
// begin
// frxReport1.PrintOptions.ShowDialog := false;
// frxReport1.PrepareReport(true);
// frxReport1.Print();
// end;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD>ҵ<EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
if againPring then
begin
with ADOQueryBaseCmd do
begin
Close;
SQL.Clear;
SQL.Add('insert into Trade_Need_Up(UType,UOperation,UDataId,uoperator) values(''<27><><EFBFBD><EFBFBD>'',''<27>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>ǩ'',' + QuotedStr(trim(cds_3.fieldbyName('CIID').AsString)) + ',' + QuotedStr(DName) + ') ');
ExecSQL;
end;
end;
if FileExists(fImagePath) then
DeleteFile(fImagePath);
end;
procedure TfrmMachRollMain.InitJTM(MCIID: string);
begin
with ADOQueryBaseTemp do
begin
Close;
SQL.Clear;
SQL.Add('select * from BS_Cloth_IO where StkId=''' + trim(MCIID) + ''' and IOFlag=''<27><><EFBFBD><EFBFBD>''');
Open;
if not IsEmpty then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܲ<EFBFBD><DCB2><EFBFBD>!', '<27><>ʾ', 0);
exit;
end;
end;
//
with ADOQueryBaseTemp do
begin
Close;
SQL.Clear;
SQL.Add('select * from BS_Cloth_IO where StkId=''' + trim(MCIID) + ''' and IOFlag=''<27><><EFBFBD><EFBFBD>''');
Open;
end;
if not ADOQueryBaseTemp.IsEmpty then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܲ<EFBFBD><DCB2><EFBFBD>!', '<27><>ʾ', 0);
exit;
end;
with ADOQueryBaseTemp do
begin
Close;
SQL.Clear;
SQL.Add('select * from Trade_Cloth_Inspect where CIID=''' + trim(MCIID) + '''');
Open;
end;
if not ADOQueryBaseTemp.IsEmpty then
begin
FOperationStatus := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
FCIID := MCIID;
InitCDGrid(MCIID);
end;
end;
//
procedure TfrmMachRollMain.BadSpeedButtonClick(Sender: TObject);
var
i: Integer;
begin
inherited;
if CheckData('<27>õ<EFBFBD>') = false then
exit;
frameBads1.dxPanel1.Visible := true;
FCIFName := trim(TSpeedButton(Sender).Hint);
frameBads1.lblCIFName.Caption := trim(TSpeedButton(Sender).Hint);
frameBads1.CIFNumber.SetFocus;
frameBads1.CIFNumber.text := '1';
frameBads1.CIFBeg.text := trim(Self.InputLen.text);
frameBads1cxCheckBox_readLenPropertiesChange(frameBads1.IsSubtract);
end;
procedure TfrmMachRollMain.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;
if (SCXFlag = '1') or (SCXFlag = '2') then
begin
if frameBads1.lblLenUnit1.Caption = 'M' then
begin
InputLen.Text := format('%.' + trim(FMPlace) + 'f', [i1 / 100000]);
end
else
InputLen.Text := format('%.' + trim(FMPlace) + 'f', [i1 / 100000 / 0.9144]);
end
else
begin
InputLen.Text := format('%.' + trim(FMPlace) + 'f', [i1 / 100000]);
if i2 = 0 then
begin
SetUnit('M');
end
else
begin
SetUnit('Y');
end;
end;
end;
end;
procedure TfrmMachRollMain.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('%.' + trim(FKgPlace) + 'f', [i1 / 100000]);
end;
end;
procedure TfrmMachRollMain.PrtMD(MInNo: string);
var
fPrintFile, FLBName: string;
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
SQL.Add(' EXEC P_Trade_Cloth_In_Prt11 ');
SQL.Add(' @Filtration=''' + trim(MInNo) + '''');
Open;
end;
FLBName := '<27><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⵥ';
ExportFtErpFile(FLBName + '.rmf', ADOQueryBaseTemp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + FLBName + '.rmf';
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
RM1.DefaultCopies := cds_params.fieldbyName('labNumber').AsInteger;
RM1.PrintReport;
end
else
begin
Application.MessageBox(pchar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
end;
/// ////////////
procedure TfrmMachRollMain.initEditPiece();
begin
if BTPrint.Caption = '<27><> <20><>' then
begin
BTPrint.Caption := '<27>޸<EFBFBD><DEB8>ύ';
with cds_3 do
begin
InputLen.Text := fieldbyName('InputLen').AsString;
InputWeight.Text := fieldbyName('InputWeight').AsString;
Tare.Text := fieldbyName('Tare').AsString;
grade.ItemIndex := grade.Properties.Items.IndexOf(trim(fieldbyName('grade').AsString));
// Coefficient.Text:=fieldByName('Coefficient').AsString;
end;
edtPacketNo.Enabled := False;
end
else
begin
BTPrint.Caption := '<27><> <20><>';
InputLen.Text := '';
InputWeight.Text := '';
OutPutWeight.Text := '';
edtPacketNo.Enabled := true;
grade.ItemIndex := 0;
cds_params.edit;
cds_params.fieldbyName('chen').value := '1';
cds_params.fieldbyName('mabiao').value := '1';
cds_params.Post;
end;
end;
procedure TfrmMachRollMain.GetPacketNo();
var
mMaxPacketNo: string;
begin
try
with ADOQueryBaseTemp do
begin
Close;
SQL.Clear;
SQL.Add('select max(cast(isnull(PacketNo,''0'') as int) )+1 as MaxPacketNo from Trade_Cloth_Inspect ');
SQL.Add('where OrderNo=' + QuotedStr(trim(OrderNo.Text)));
Open;
end;
mMaxPacketNo := trim(ADOQueryBaseTemp.fieldbyName('MaxPacketNo').AsString);
if mMaxPacketNo = '' then
mMaxPacketNo := '1';
edtPacketNo.Text := mMaxPacketNo;
except
end;
end;
procedure TfrmMachRollMain.GetRulePacketNo();
var
mMaxPacketNo: string;
begin
try
if FRulePackNo = '<27><><EFBFBD>׺<EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
begin
with ADOQueryBaseTemp do
begin
Close;
SQL.Clear;
SQL.Add('select max(cast(isnull(PacketNo,''0'') as int) )+1 as MaxPacketNo from Trade_Cloth_Inspect X ');
sql.Add('where X.mainID=''' + Trim(FMainId) + ''' and X.subid=''' + Trim(FSubId) + ''' and X.c_color=' + quotedstr(Trim(FC_Color)) + ' and isnull(X.BatchNO,'''')=' + quotedstr(Trim(BatchNO.Text)));
Open;
end;
end
else if FRulePackNo = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
with ADOQueryBaseTemp do
begin
Close;
SQL.Clear;
SQL.Add('select max(cast(isnull(PacketNo,''0'') as int) )+1 as MaxPacketNo from Trade_Cloth_Inspect X ');
SQL.Add('where X.mainID=''' + Trim(FMainId) + ''' and OrderNo=' + QuotedStr(trim(OrderNo.Text)));
Open;
end;
end
else if FRulePackNo = '<27><><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>' then
begin
with ADOQueryBaseTemp do
begin
Close;
SQL.Clear;
SQL.Add('select max(cast(isnull(PacketNo,''0'') as int) )+1 as MaxPacketNo from Trade_Cloth_Inspect X ');
sql.Add('where X.mainID=''' + Trim(FMainId) + ''' and X.subid=''' + Trim(FSubId) + ''' and X.c_color=' + quotedstr(Trim(FC_Color)));
Open;
end;
end
else
begin
with ADOQueryBaseTemp do
begin
Close;
SQL.Clear;
SQL.Add('select max(cast(isnull(PacketNo,''0'') as int) )+1 as MaxPacketNo from Trade_Cloth_Inspect X ');
SQL.Add('where X.mainID=''' + Trim(FMainId) + ''' and OrderNo=' + QuotedStr(trim(OrderNo.Text)));
Open;
end;
end;
mMaxPacketNo := trim(ADOQueryBaseTemp.fieldbyName('MaxPacketNo').AsString);
if mMaxPacketNo = '' then
mMaxPacketNo := '1';
edtPacketNo.Text := mMaxPacketNo;
except
end;
end;
procedure TfrmMachRollMain.getPlanImage(MSubID: string);
begin
with ADOQueryImage do
begin
close;
sql.Clear;
sql.Add('select top 1 * from TP_File A');
sql.Add('where WBID=' + quotedstr(MSubID));
open;
end;
end;
/////////////////////////////////////
function TfrmMachRollMain.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;
if inttostr(packNo + 1) = trim(edtPacketNo.Text) then
begin
edtPacketNo.Text := inttostr(packNo);
end;
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;
//////////////////////////////////////////////////////
///
function TfrmMachRollMain.checkPicecNo(): boolean;
var
pieceNo: string;
begin
result := false;
if FRulePieceNo = '' then
begin
ADOQueryBaseCmd.Connection.RollbackTrans;
showMessage('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>þ<EFBFBD><C3BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>!');
exit;
end;
try
//////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>ж<EFBFBD>
with ADOQueryBaseCmd do
begin
Close;
sql.Clear;
if FRulePieceNo = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
sql.Add('select Mainid,pieceNo from Trade_Cloth_Inspect X where X.mainID=' + quotedstr(Trim(FMainId)));
sql.Add(' Group by Mainid,pieceNo having count(*)>1');
end
else if FRulePieceNo = '<27><><EFBFBD>׺<EFBFBD><D7BA><EFBFBD><EFBFBD><EFBFBD>' then
begin
sql.Add('select mainId,C_color,batchNo,pieceNo from Trade_Cloth_Inspect X ');
sql.Add('where X.mainID=''' + Trim(FMainId) + ''' and X.subid=''' + Trim(FSubId) + ''' and X.c_color=' + quotedstr(Trim(FC_Color)) + ' and isnull(X.BatchNO,'''')=' + quotedstr(Trim(BatchNO.Text)));
sql.Add(' Group by mainId,C_color,BatchNO,pieceNo having count(*)>1');
end
else if FRulePieceNo = '<27><><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>' then
begin
sql.Add('select mainId,C_color,pieceNo from Trade_Cloth_Inspect X ');
sql.Add('where X.mainID=''' + Trim(FMainId) + ''' and X.subid=''' + Trim(FSubId) + ''' and X.c_color=' + quotedstr(Trim(FC_Color)));
sql.Add(' Group by mainId,C_color,pieceNo having count(*)>1');
end;
Open;
end;
if not ADOQueryBaseCmd.IsEmpty then
begin
ADOQueryBaseCmd.Connection.RollbackTrans;
pieceNo := Trim(ADOQueryBaseCmd.fieldbyname('pieceNo').AsString);
if fileexists(ExtractFilePath(Application.ExeName) + '<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>.wav') then
PlaySound('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
Application.MessageBox(Pchar('<27><><EFBFBD><EFBFBD>: ' + Trim(pieceNo) + ' <20>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶Դ<CBB6><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!'), '<27><>ʾ', 0);
Exit;
end;
//
result := true;
except
ADOQueryBaseCmd.Connection.RollbackTrans;
Application.MessageBox(Pchar('<27>жϾ<D0B6><CFBE><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ظ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!'), '<27><>ʾ', 0);
end;
end;
/////////////////////////////////////////////////////////////////
///
function TfrmMachRollMain.getCurPieceNO(mCcid: string): string;
begin
result := '';
try
with ADOQueryBaseTemp do
begin
close;
sql.Clear;
sql.Add('select PieceNo from Trade_Cloth_Inspect where CIID=' + quotedstr(mCcid));
open;
if ADOQueryBaseTemp.fieldByName('PieceNo').AsInteger > 0 then
result := intTostr(ADOQueryBaseTemp.fieldByName('PieceNo').AsInteger + 1);
end;
except
application.MessageBox('<27><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
end.