unit U_MarkingInspection; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, RM_Common, RM_Class, RM_GridReport, RM_System, RM_Dataset, ADODB, DBClient, cxGridCustomPopupMenu, cxGridPopupMenu, ExtCtrls, ComCtrls, ToolWin, cxTextEdit, Buttons, cxSplitter, cxCheckBox, MovePanel, dxCore, ActiveX, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue, dxSkinscxPCPainter; type TfrmMarkingInspection = class(TForm) cxStyleRepository1: TcxStyleRepository; cxStyle1: TcxStyle; cxStyle2: TcxStyle; cxGridPopupMenu1: TcxGridPopupMenu; DataSource1: TDataSource; Order_MJ: TClientDataSet; ADOQueryMain: TADOQuery; ADOCmd: TADOQuery; RMDB_Main: TRMDBDataSet; RM2: TRMGridReport; DataSource2: TDataSource; CDS_MJCD: TClientDataSet; DataSource3: TDataSource; CDS_MJID: TClientDataSet; Timer1: TTimer; ADOQueryPrint: TADOQuery; ScrollBox1: TScrollBox; SpeedButton13: TSpeedButton; SpeedButton14: TSpeedButton; SpeedButton15: TSpeedButton; SpeedButton16: TSpeedButton; SpeedButton17: TSpeedButton; SpeedButton18: TSpeedButton; SpeedButton21: TSpeedButton; SpeedButton22: TSpeedButton; SpeedButton23: TSpeedButton; SpeedButton24: TSpeedButton; SpeedButton25: TSpeedButton; SpeedButton26: TSpeedButton; SpeedButton29: TSpeedButton; SpeedButton30: TSpeedButton; SpeedButton31: TSpeedButton; SpeedButton32: TSpeedButton; SpeedButton33: TSpeedButton; SpeedButton34: TSpeedButton; SpeedButton37: TSpeedButton; SpeedButton38: TSpeedButton; SpeedButton39: TSpeedButton; SpeedButton40: TSpeedButton; SpeedButton41: TSpeedButton; SpeedButton42: TSpeedButton; cxGridPopupMenu2: TcxGridPopupMenu; ADOQueryMainDSC: TADOQuery; SpeedButton45: TSpeedButton; SpeedButton46: TSpeedButton; SpeedButton47: TSpeedButton; SpeedButton48: TSpeedButton; SpeedButton50: TSpeedButton; SpeedButton51: TSpeedButton; SpeedButton54: TSpeedButton; SpeedButton55: TSpeedButton; Panel2: TPanel; Label9: TLabel; MJLen: TEdit; Label4: TLabel; MJMaoZ: TEdit; Label5: TLabel; Label11: TLabel; Button5: TButton; Edit3: TEdit; Label10: TLabel; Edit4: TEdit; Label12: TLabel; Panel3: TPanel; SpeedButton1: TSpeedButton; SpeedButton2: TSpeedButton; SpeedButton3: TSpeedButton; SpeedButton4: TSpeedButton; SpeedButton5: TSpeedButton; SpeedButton6: TSpeedButton; SpeedButton7: TSpeedButton; SpeedButton8: TSpeedButton; SpeedButton9: TSpeedButton; SpeedButton10: TSpeedButton; SpeedButton11: TSpeedButton; SpeedButton12: TSpeedButton; SpeedButton49: TSpeedButton; Label26: TLabel; Edit6: TEdit; Label30: TLabel; MJQty3: TEdit; Label31: TLabel; Label32: TLabel; MJQty4: TEdit; Label33: TLabel; MovePanel1: TMovePanel; Label17: TLabel; Label18: TLabel; Label19: TLabel; Label20: TLabel; Label21: TLabel; Label7: TLabel; Label8: TLabel; Edit1: TEdit; Button1: TButton; Button4: TButton; Edit2: TEdit; CDQty: TEdit; RadioGroup1: TRadioGroup; Button2: TButton; Panel7: TPanel; cxGrid2: TcxGrid; Tv2: TcxGridDBTableView; tv2CDType: TcxGridDBColumn; tv2CDWZ: TcxGridDBColumn; v2Column2: TcxGridDBColumn; Tv2CDQty: TcxGridDBColumn; Tv2CDReason: TcxGridDBColumn; v2Column1: TcxGridDBColumn; v2Column3: TcxGridDBColumn; cxGridLevel1: TcxGridLevel; Panel8: TPanel; AOrdDefNote1: TRichEdit; Label34: TLabel; ComboBox1: TComboBox; Label36: TLabel; MJStr4: TEdit; Label37: TLabel; Label38: TLabel; RM3: TRMGridReport; mjxh: TEdit; ADOTmp: TADOQuery; Panel5: TPanel; Panel6: TPanel; Label1: TLabel; lblCode: TLabel; Label35: TLabel; Label39: TLabel; APID: TEdit; Edit7: TEdit; Edit8: TEdit; ToolBar1: TToolBar; ToolButton1: TToolButton; TBCD: TToolButton; TBClose: TToolButton; lblMPRTCodeName: TLabel; lblcolor: TLabel; ToolButton3: TToolButton; ToolButton2: TToolButton; MJBanZu: TComboBox; Label3: TLabel; Label6: TLabel; KuangHao: TEdit; KuWei: TEdit; Button3: TButton; ToolButton4: TToolButton; lblMPRTSpec: TLabel; Label13: TLabel; Label15: TLabel; MJKZ: TEdit; MJMF: TEdit; edtDel: TEdit; Label2: TLabel; cxSplitter1: TcxSplitter; Panel1: TPanel; cxGrid3: TcxGrid; Tv3: TcxGridDBTableView; cxGridDBColumn1: TcxGridDBColumn; v3Column6: TcxGridDBColumn; v3Column1: TcxGridDBColumn; v3Column2: TcxGridDBColumn; v3Column4: TcxGridDBColumn; v3Column5: TcxGridDBColumn; v3Column3: TcxGridDBColumn; cxGridLevel2: TcxGridLevel; Label14: TLabel; Edit5: TEdit; Button6: TButton; lblKH: TLabel; BTPrint: TSpeedButton; edtJH: TEdit; Label16: TLabel; ToolButton5: TToolButton; ToolButton6: TToolButton; cxGrid4: TcxGrid; TV4: TcxGridDBTableView; cxGridDBColumn2: TcxGridDBColumn; cxGridDBColumn3: TcxGridDBColumn; cxGridLevel3: TcxGridLevel; ToolButton7: TToolButton; DS_LCKHZ: TDataSource; CDS_LCKHZ: TClientDataSet; V4Column1: TcxGridDBColumn; V4Column2: TcxGridDBColumn; Label22: TLabel; JYXH: TComboBox; Label23: TLabel; Edit9: TEdit; ToolButton8: TToolButton; Panel4: TPanel; mima1: TLabel; mima2: TLabel; MKXS: TEdit; Edit10: TEdit; Button7: TButton; Button8: TButton; SpeedButton19: TSpeedButton; Label24: TLabel; Ekjlen: TEdit; Button9: TButton; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure TBCloseClick(Sender: TObject); procedure TBCDClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean); procedure SpeedButton1Click(Sender: TObject); procedure SpeedButton12Click(Sender: TObject); procedure SpeedButton13Click(Sender: TObject); procedure cxGridDBColumn2PropertiesChange(Sender: TObject); procedure Button1Click(Sender: TObject); procedure ToolButton1Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure SpeedButton49Click(Sender: TObject); procedure APIDKeyPress(Sender: TObject; var Key: Char); procedure Edit1Click(Sender: TObject); procedure Edit2Change(Sender: TObject); procedure Edit3Click(Sender: TObject); procedure Edit4Click(Sender: TObject); procedure Edit6Click(Sender: TObject); procedure MJstr3KeyPress(Sender: TObject; var Key: Char); procedure Label9Click(Sender: TObject); procedure MJQty4Exit(Sender: TObject); procedure Button2Click(Sender: TObject); procedure MJQty4Change(Sender: TObject); procedure MJMaoZChange(Sender: TObject); procedure APIDClick(Sender: TObject); procedure Edit7Click(Sender: TObject); procedure MJQty4KeyPress(Sender: TObject; var Key: Char); procedure FormCreate(Sender: TObject); procedure Edit8Click(Sender: TObject); procedure Tv3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean); procedure ToolButton3Click(Sender: TObject); procedure ToolButton2Click(Sender: TObject); procedure Tv3DblClick(Sender: TObject); procedure Button3Click(Sender: TObject); procedure ToolButton4Click(Sender: TObject); procedure edtDelClick(Sender: TObject); procedure Button6Click(Sender: TObject); procedure MJBanZuChange(Sender: TObject); procedure SpeedButton19Click(Sender: TObject); procedure edtJHClick(Sender: TObject); procedure ToolButton5Click(Sender: TObject); procedure ToolButton6Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure ToolButton7Click(Sender: TObject); procedure Edit9Click(Sender: TObject); procedure JYXHClick(Sender: TObject); procedure ToolButton8Click(Sender: TObject); procedure Button8Click(Sender: TObject); procedure Button7Click(Sender: TObject); procedure MJQty3Change(Sender: TObject); private { Private declarations } FColumn, FAPID, FMainId, FSubId, FFFMJID, FOperationStatus: string; FCDName: string; isCommopen, IsJsMessage: boolean; fxsType, fRollType: string; FKongJia, FKongJiaWei, FBaoZhuangDai: Double; FMMF: Integer; Fkaipi: string; procedure InitJP(); //刷新疵点选项 procedure InitCDGrid(); //刷新疵点信息 procedure InitCDGridID(); //刷新检验信息 function CheckData(CKType: string): Boolean; //校验数据 function SaveData(): Boolean; //保存数据 function DelData(MMJID: string): Boolean; //删除数据 procedure InitLCK(); //扫描流程卡 procedure InitJYXX(); //扫描卷条码 procedure ClearGlobal(); //清除全局ID procedure PrintCKMDG(MRKOrdID: string); //打印入库单 procedure PrtData(FMJID: string); //打印卷标签 procedure OpenCom(DllName: string); procedure CloseCom(DllName: string); procedure On1201(var Message: Tmessage); message 1201; procedure On1301(var Message: Tmessage); message 1301; public fmanage: string; fGY: string; fXH: array[0..20] of string; fxjno: Integer; fxjjc: array[0..7] of string; fxsws, fcdws: string; Fisgh: string; xjint: Integer; { Public declarations } end; var frmMarkingInspection: TfrmMarkingInspection; newh, newh1: hwnd; implementation uses U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_ProductOrderListSel, U_KuangHaoSel; {$R *.dfm} function TfrmMarkingInspection.DelData(MMJID: string): Boolean; var FSMIS, Fopevent: string; begin FSMIS := Trim(APID.Text); // if Application.MessageBox('确定要作废数据吗?作废后数据不能恢复。', '提示', 32 + 4) <> IDYES then // Exit; if CDS_MJID.Locate('MJID', MMJID, []) then begin Fopevent := '卷条码:' + trim(MMJID) + ' 卷号:' + Trim(CDS_MJID.fieldbyname('MJXH').AsString); end else begin Application.MessageBox('无法找到该布匹!', '提示', 0); Exit; end; with ADOTmp do begin Close; sql.Clear; sql.Add('select * from CK_BanCP_CR where MJID=''' + Trim(MMJID) + ''' and CRFlag=''出库'''); Open; end; if ADOTmp.IsEmpty = False then begin Application.MessageBox('已产生出库数据不能删除!', '提示', 0); Exit; end else begin with ADOCmd do begin Close; sql.Clear; sql.Add('delete WFB_MJJY where MJID=''' + Trim(MMJID) + ''''); sql.Add('delete CK_BanCP_CR where MJID=''' + Trim(MMJID) + ''''); sql.Add('delete CK_BanCP_KC where MJID=''' + Trim(MMJID) + ''''); sql.Add('delete WFB_MJJY_CD where MJID=''' + Trim(MMJID) + ''''); sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( '); sql.Add(' ' + quotedstr(trim(DName))); sql.Add(',getdate() '); sql.Add(',' + quotedstr(trim(self.Caption))); sql.Add(',' + quotedstr(trim('作废检验数据'))); sql.Add(',' + quotedstr(Fopevent)); sql.Add(',' + quotedstr(trim('成功'))); sql.Add(')'); ExecSQL; end; end; CDS_MJID.Delete; APID.Text := ''; end; function TfrmMarkingInspection.CheckData(CKType: string): Boolean; var mvalue: Double; begin try if Trim(FAPID) = '' then raise Exception.Create('请扫描流程卡!'); if Trim(FMainId) = '' then raise Exception.Create('请扫描流程卡!'); if Trim(FSubId) = '' then raise Exception.Create('请扫描流程卡!'); if FOperationStatus = '重新扫描' then raise Exception.Create('请扫描流程卡!'); if Trim(CKType) = '提交' then begin if (trim(JYXH.Text) = '') and (Fisgh = '有') then raise Exception.Create('缸号不能为空!'); // if trim(KuWei.Text) = '' then // raise Exception.Create('库位不能为空!'); // if trim(MJMF.Text) = '' then // raise Exception.Create('门幅不能为空!'); // // if trim(MJKZ.Text) = '' then // raise Exception.Create('克重不能为空!'); if trim(Label9.Caption) = '' then raise Exception.Create('长度单位不能为空!'); if Trim(MJMaoZ.Text) <> '' then begin if TryStrToFloat(MJMaoZ.Text, mvalue) = False then raise Exception.Create('重量录入错误!'); if strtofloatdef(trim(MJMaoZ.Text), 0) > 200 then raise Exception.Create('重量不能大于200!'); end; if strtofloatdef(trim(MJQty4.Text), 0) < 0.00 then raise Exception.Create('重量不能小于0!'); if strtofloatdef(trim(MJLen.Text), 0) < 5.00 then raise Exception.Create('长度不能小于5!'); if Trim(MJLen.Text) <> '' then begin if strtofloatdef(trim(MJLen.Text), 0) > 400 then raise Exception.Create('长度不能大于400!'); end; if (strtofloatdef(trim(MJLen.Text), 0) = 0) and (strtofloatdef(trim(MJQty4.Text), 0) = 0) then raise Exception.Create('长度和重量不能都为0!!'); end; Result := True; except Result := false; application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0); end; end; procedure TfrmMarkingInspection.ClearGlobal(); begin FAPID := ''; FMainId := ''; FSubId := ''; FFFMJID := ''; FKongJia := 0; FKongJiaWei := 0; lblCode.Caption := '编号'; lblMPRTCodeName.Caption := '品名'; lblcolor.Caption := '颜色'; lblMPRTSpec.Caption := '缸号'; lblKH.Caption := '客户'; MJXH.Text := ''; MJstr4.Text := ''; MKXS.Text := ''; AOrdDefNote1.Text := ''; MJQty3.Text := ''; MJQty4.Text := ''; KuangHao.Text := ''; end; procedure TfrmMarkingInspection.PrintCKMDG(MRKOrdID: string); var fPrintFile: string; Txt, fImagePath: string; Moudle: THandle; Makebar: TMakebar; Mixtext: TMixtext; begin with ADOQueryPrint do begin Close; SQL.Clear; sql.Add(' exec P_Print_RKMDGangNo '); SQL.Add(' @RKOrdID=''' + Trim(MRKOrdID) + ''''); Open; end; try Moudle := LoadLibrary('MakeQRBarcode.dll'); @Makebar := GetProcAddress(Moudle, 'Make'); @Mixtext := GetProcAddress(Moudle, 'MixText'); Txt := Trim(ADOQueryPrint.fieldbyname('RKOrdID').AsString); fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp'; if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil); if FileExists(fImagePath) then DeleteFile(fImagePath); Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3); except application.MessageBox('条形码生成失败!', '提示信息', MB_ICONERROR); exit; end; fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\仓库码单.rmf'; if FileExists(fPrintFile) then begin RMVariables['QRBARCODE'] := fImagePath; RMVariables['DMR'] := Trim(DName); RM2.LoadFromFile(fPrintFile); Rm2.DefaultCopies := 1; RM2.ShowReport; end else begin Application.MessageBox(PChar('没有找' + fPrintFile), '提示', 0); Exit; end; end; procedure TfrmMarkingInspection.InitJYXX(); begin with ADOTmp do begin Close; sql.Clear; sql.Add('select MJID from CK_BanCP_CR where CRFlag<>''出库'' '); sql.Add('and MJID=' + quotedstr(FFFMJID)); Open; end; if ADOTmp.IsEmpty = False then begin Application.MessageBox('出库数据不能修改!', '提示', 0); exit; end; with ADOTmp do begin Close; sql.Clear; sql.Add('select A.*,B.*,C.* '); sql.Add(',D.*'); sql.Add('from JYOrder_car A'); sql.Add('inner join JYOrder_Main B on A.MainId=B.MainId'); sql.Add('inner join JYOrder_Sub C on A.SubId=C.SubId'); sql.Add('inner join WFB_MJJY D on D.APID=A.CarNo'); sql.Add('where D.MJID=' + quotedstr(FFFMJID)); Open; end; if ADOTmp.IsEmpty = False then begin FAPID := Trim(ADOTmp.fieldbyname('CarNo').AsString); FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString); FSubId := Trim(ADOTmp.fieldbyname('SubId').AsString); MJXH.Text := Trim(ADOTmp.fieldbyname('MJXH').AsString); // if ADOTmp.fieldbyname('iskj').AsBoolean then begin FKongJia := ADOTmp.fieldbyname('KongJia').AsFloat; FKongJiaWei := ADOTmp.fieldbyname('KongJiaWei').AsFloat; end; FBaoZhuangDai := ADOTmp.fieldbyname('BaoZhuangDai').AsFloat; MJQty3.Text := Trim(ADOTmp.fieldbyname('PiZhong').AsString); MJstr4.Text := ''; MJQty4.Text := Trim(ADOTmp.fieldbyname('MJQty4').AsString); MJMaoZ.Text := Trim(ADOTmp.fieldbyname('MJMaoZ').AsString); KuWei.Text := Trim(ADOTmp.fieldbyname('KuWei').AsString); KuangHao.Text := Trim(ADOTmp.fieldbyname('KuangHao').AsString); MKXS.Text := Trim(ADOTmp.fieldbyname('Xs').AsString); MJBanZu.ItemIndex := MJBanZu.Items.IndexOf(trim(ADOTmp.fieldbyname('MJBanZu').AsString)); lblKH.Caption := trim(ADOTmp.fieldbyname('CustomerNoName').AsString); if Trim(ADOTmp.FieldByName('MJType').AsString) = '正品' then begin Edit3.Text := '√'; Edit4.Text := ''; end else begin Edit3.Text := ''; Edit4.Text := '√'; end; lblCode.Caption := Trim(ADOTmp.fieldbyname('MPRTCode').AsString); lblMPRTCodeName.Caption := Trim(ADOTmp.fieldbyname('MPRTCodeName').AsString); AOrdDefNote1.Text := '包装要求:' + Trim(ADOTmp.fieldbyname('MPRTBZNote').AsString) + #13 + '门幅:' + Trim(ADOTmp.fieldbyname('MPRTMF').AsString) + #13 + '克重:' + Trim(ADOTmp.fieldbyname('MPRTKZ').AsString) + #13 + '特别提示:' + Trim(ADOTmp.fieldbyname('Note').AsString); lblcolor.Caption := trim(ADOTmp.fieldbyname('PRTColor').AsString); if trim(ADOTmp.fieldbyname('KKGH').AsString) = '' then begin lblMPRTSpec.Caption := trim(ADOTmp.fieldbyname('MPRTSpec').AsString); end else begin lblMPRTSpec.Caption := trim(ADOTmp.fieldbyname('KKGH').AsString) end; if Trim(ADOTmp.fieldbyname('OrderUnit').AsString) <> '' then begin Label19.Caption := Label9.Caption; Label20.Caption := Label9.Caption; Label7.Caption := Label9.Caption; end; end else begin ClearGlobal(); end; InitCDGridID(); InitCDGrid(); APID.Text := ''; end; procedure TfrmMarkingInspection.InitLCK(); var ts: TStrings; i: Integer; fsj: string; begin with ADOTmp do begin Close; sql.Clear; sql.Add('select A.* '); sql.Add('from JYOrder_car A'); sql.Add('where A.FromCarNo=' + quotedstr(FAPID)); Open; end; if ADOTmp.IsEmpty = False then begin Application.MessageBox('该卡已拆分!', '提示', 0); exit; end; with ADOTmp do begin Close; sql.Clear; sql.Add('select A.*,B.*,C.* '); sql.Add(',maxRoll=1+isnull((select cast (max(mjxh) as int) from WFB_MJJY X where X.APID=A.CarNo and X.MJType =''正品'' ),0)'); sql.Add('from JYOrder_car A'); sql.Add('inner join JYOrder_Main B on A.MainId=B.MainId'); sql.Add('inner join JYOrder_Sub C on A.SubId=C.SubId'); sql.Add('where A.status=''1'' and CarNo=' + quotedstr(FAPID)); //ShowMessage(SQL.Text); Open; end; if ADOTmp.IsEmpty = False then begin FAPID := Trim(ADOTmp.fieldbyname('CarNo').AsString); FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString); FSubId := Trim(ADOTmp.fieldbyname('SubId').AsString); begin FKongJia := ADOTmp.fieldbyname('KongJia').AsFloat; FKongJiaWei := ADOTmp.fieldbyname('KongJiaWei').AsFloat; end; FBaoZhuangDai := ADOTmp.fieldbyname('BaoZhuangDai').AsFloat; MJXH.Text := Trim(ADOTmp.fieldbyname('maxRoll').AsString); MJMF.Text := Trim(ADOTmp.fieldbyname('KKMF').AsString); MJKZ.Text := Trim(ADOTmp.fieldbyname('KKKZ').AsString); MJstr4.Text := ''; lblCode.Caption := Trim(ADOTmp.fieldbyname('MPRTCode').AsString); lblMPRTCodeName.Caption := Trim(ADOTmp.fieldbyname('MPRTCodeName').AsString); MKXS.Text := Trim(ADOTmp.fieldbyname('Xs').AsString); AOrdDefNote1.Text := '包装要求:' + Trim(ADOTmp.fieldbyname('MPRTBZNote').AsString) + #13 + '门幅:' + Trim(ADOTmp.fieldbyname('MPRTMF').AsString) + #13 + '克重:' + Trim(ADOTmp.fieldbyname('MPRTKZ').AsString) + #13 + '特别提示:' + Trim(ADOTmp.fieldbyname('Note').AsString); MJQty3.Text := Trim(ADOTmp.fieldbyname('PiZhong').AsString); lblcolor.Caption := trim(ADOTmp.fieldbyname('PRTColor').AsString); lblMPRTSpec.Caption := trim(ADOTmp.fieldbyname('MPRTSpec').AsString); lblKH.Caption := trim(ADOTmp.fieldbyname('CustomerNoName').AsString); fGY := trim(ADOTmp.fieldbyname('KKGY').AsString); fxsws := trim(ADOTmp.fieldbyname('xsws').AsString); fcdws := trim(ADOTmp.fieldbyname('cdws').AsString); i := 0; while i < xjint do begin fxjjc[i] := trim(ADOTmp.fieldbyname('jlen' + IntToStr(i + 1)).AsString); i := i + 1; end; if Trim(ADOTmp.fieldbyname('OrderUnit').AsString) <> '' then begin Label19.Caption := Label9.Caption; Label20.Caption := Label9.Caption; Label7.Caption := Label9.Caption; end; end else begin Application.MessageBox('请确认该卡是否已审核!', '提示', 0); ClearGlobal(); end; // InitCDGridID(); InitCDGrid(); APID.Text := ''; ///////////////////////////////读取流程卡合同 ///////////////////////////////读取工序型号 JYXH.Clear; fsj := 'select distinct(glidename) name from JYOrder_glide where carno=' + quotedstr(Trim(FAPID)); SInitComBoxBySql(ADOTmp, JYXH, True, fsj); if JYXH.Text <> '' then begin Fisgh := '有'; end else begin Fisgh := ''; end; JYXH.Text := ''; InitCDGridID(); end; procedure TfrmMarkingInspection.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('找不到 ' + trim(DllName) + ' 文件!'), '提示'); end; end; procedure TfrmMarkingInspection.OpenCom(DllName: string); type TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): HWND; stdcall; var Tf: TMyFunc; Tp: TFarProc; Th: Thandle; begin // closeCom(FComFile); Th := LoadLibrary(Pchar(trim(DllName))); if Th > 0 then begin try Tp := GetProcAddress(Th, 'CommOpen'); if Tp <> nil then begin Tf := TMyFunc(Tp); newh := Tf(self.Handle, 'Comm1', 500, 1); if newh < 1 then begin application.MessageBox(Pchar('打开串口失败!'), '提示'); end else IsCommOpen := true; end else begin IsCommOpen := false; end; finally // FreeLibrary(Th); end; end else begin IsCommOpen := false; application.MessageBox(Pchar('找不到 ' + trim(DllName) + ' 文件!'), '提示'); end; end; procedure TfrmMarkingInspection.FormDestroy(Sender: TObject); begin frmMarkingInspection := nil; end; procedure TfrmMarkingInspection.On1301(var Message: Tmessage); var i1, i2: integer; unitname: string; fdata: double; begin i1 := Message.WParam; i2 := Message.LParam; if IsJsMessage then begin if (trim(Edit9.Text) = '√') then begin MJLen.Text := format('%.' + fcdws + 'f', [i1 / 100000]); if i2 = 0 then Label9.Caption := 'M' else Label9.Caption := 'Y'; edit1.Text := format('%.' + fcdws + 'f', [i1 / 100000]); end; end; end; procedure TfrmMarkingInspection.On1201(var Message: Tmessage); var i1, i2: integer; unitname: string; fdata: double; begin i1 := Message.WParam; i2 := Message.LParam; if IsJsMessage then begin if trim(Edit7.Text) = '√' then begin MJMaoZ.Text := format('%.' + fxsws + 'f', [i1 / 100000]); end; end; end; procedure TfrmMarkingInspection.FormClose(Sender: TObject; var Action: TCloseAction); begin //DataLink_WFBProducttion.ADOLink.Connected:=False; if isCommopen then begin closeCom(DllName); closeCom(JCYDLL); end; Action := caFree; end; procedure TfrmMarkingInspection.InitCDGrid(); begin with ADOQueryMain do begin Close; SQL.Clear; sql.Add('select * from WFB_MJJY_CD where MJID=' + quotedstr(Trim(FFFMJID))); Open; end; SCreateCDS20(ADOQueryMain, CDS_MJCD); SInitCDSData20(ADOQueryMain, CDS_MJCD); end; procedure TfrmMarkingInspection.InitCDGridID(); begin with ADOQueryMain do begin Close; SQL.Clear; sql.Add('select A.*'); sql.Add('from WFB_MJJY A where APID=''' + Trim(FAPID) + ''''); if Trim(SCXFlag) <> '' then sql.Add(' and JTType=''' + Trim(SCXFlag) + ''''); sql.Add(' and MJBanZu=''' + Trim(MJBanZu.Text) + ''''); // sql.Add(' and Filler=''' + Trim(DName) + ''''); SQL.Add(' and JYXH=''' + Trim(JYXH.Text) + ''''); // sql.Add(' and MJstr2=''未入库'' '); if v3Column1.SortOrder = soDescending then begin sql.Add(' order by MJXH desc '); end else begin sql.Add(' order by MJXH '); end; // showmessage(sql.Text); Open; end; SCreateCDS20(ADOQueryMain, CDS_MJID); SInitCDSData20(ADOQueryMain, CDS_MJID); with ADOTmp do begin Close; SQL.Clear; sql.Add('select B.CustomerNoName,count(MJID) PS ,APID,SUM(MJMAOZ) MJMAOZ'); sql.Add('from WFB_MJJY A inner join jyorder_main B on A.Mainid=B.Mainid '); sql.Add(' where convert(varchar(10),A.filltime,120)=convert(varchar(10),getdate(),120) '); if Trim(SCXFlag) <> '' then sql.Add(' and JTType=''' + Trim(SCXFlag) + ''''); // sql.Add(' and A.Filler=''' + Trim(DName) + ''''); sql.Add(' GROUP BY APID,B.CustomerNoName'); Open; end; SCreateCDS20(ADOTmp, CDS_LCKHZ); SInitCDSData20(ADOTmp, CDS_LCKHZ); // with ADOTmp do // begin // Close; // sql.Clear; // sql.Add('select B.Glidename'); // sql.Add(',maxroll=(select max(mjXH) from WFB_MJJY X where X.APID=A.CARNO and X.JYXH=B.Glidename)+1'); // sql.Add('from JYOrder_car A '); // sql.Add('inner join JYOrder_Glide B on A.carno=B.carno '); // sql.Add('where A.CarNo=' + quotedstr(Trim(FAPID))); // sql.Add('and B.Glidename=' + quotedstr(Trim(JYXH.Text))); // showmessage(SQL.text); // Open; // end; // if (ADOTmp.IsEmpty = False) or (ADOTmp.fieldbyname('maxRoll').Asstring <> '')then // begin // // MJXH.Text := IntToStr(ADOTmp.fieldbyname('maxRoll').Asinteger+1); // end // else // begin // MJXH.Text :='1'; // end; with ADOTmp do begin Close; SQL.Clear; sql.Add('select kaipi'); sql.Add('from JYOrder_Glide where CARNO=''' + Trim(FAPID) + ''''); sql.Add('and GlideName=''' + trim(JYXH.Text) + ''''); // sql.Add(' GROUP BY APID,B.CustomerNoName'); // ShowMessage(SQL.text); Open; end; Fkaipi := Adotmp.FieldByName('kaipi').Asstring; end; procedure TfrmMarkingInspection.TBCloseClick(Sender: TObject); begin CloseCom(DllName); CloseCom(JCYDLL); Close; end; procedure TfrmMarkingInspection.TBCDClick(Sender: TObject); begin try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := 'WFBCD'; flagname := '疵点'; fnote := True; V1Note.Caption := '英文名称'; if ShowModal = 1 then begin Self.InitJP(); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmMarkingInspection.FormShow(Sender: TObject); begin //小卷减长数量上限8 xjint := 8; InitJP(); InitCDGrid(); if trim(Edit7.Text) = '√' then IsJsMessage := true; if trim(fmanage) <> '高权限' then begin if trim(DllName) <> '' then OpenCom(DllName); if trim(JCYDLL) <> '' then OpenCom(JCYDLL); Edit7.Visible := true; Label35.Visible := true; end; end; procedure TfrmMarkingInspection.InitJP(); var AA: array[0..100] of string; i, j: Integer; begin with ADOTmp do begin Close; sql.Clear; sql.Add('select ZDYName from KH_Zdy where Type=''WFBCD'' order by ZDYNO '); Open; end; if ADOTmp.IsEmpty then begin Application.MessageBox('没有定义疵点!', '提示', 0); Exit; end; with ADOTmp do begin First; i := 0; while not Eof do begin AA[i] := Trim(fieldbyname('ZDYName').AsString); i := i + 1; Next; end; end; i := i - 1; if i > 32 then begin i := 32; end; for j := 0 to i do begin with ScrollBox1 do begin TSpeedButton(Controls[j]).Visible := True; TSpeedButton(Controls[j]).Hint := AA[j]; if Length(AA[j]) > 4 then begin TSpeedButton(Controls[j]).Caption := Copy(Trim(AA[j]), 1, 4) + #13 + Copy(Trim(AA[j]), 5, Length(AA[j]) - 4); end else TSpeedButton(Controls[j]).Caption := AA[j]; end; end; end; procedure TfrmMarkingInspection.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean); begin if CDS_MJCD.IsEmpty then Exit; if Application.MessageBox('确定要删除数据吗?', '提示', 32 + 4) <> IDYES then Exit; if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then begin CDS_MJCD.Delete; end else begin with ADOCmd do begin Close; sql.Clear; sql.Add('delete WFB_MJJY_CD where MCID=''' + Trim(CDS_MJCD.fieldbyname('MCID').AsString) + ''''); ExecSQL; end; CDS_MJCD.Delete; end; end; function TfrmMarkingInspection.SaveData(): Boolean; var maxno, FMJID, BZID, strsql: string; FMJLen: Double; begin if FOperationStatus = '扫描卷条码' then begin FMJID := FFFMJID; FOperationStatus := '重新扫描'; end else begin FMJID := ''; end; try ADOCmd.Connection.BeginTrans; ///保存主表 with ADOCmd do begin Close; sql.Clear; SQL.Add('select * from WFB_MJJY where MJId=''' + Trim(FMJID) + ''''); Open; end; with ADOCmd do begin if Trim(FMJID) = '' then begin Append; if GetLSNo(ADOTmp, maxno, Trim(SCXFlag), 'WFB_MJJY', 4, 1) = False then begin ADOCmd.Connection.RollbackTrans; Application.MessageBox('生成流水号异常!', '提示', 0); exit; end; end else begin maxno := Trim(FMJID); Edit; end; FieldByName('MainId').value := Trim(FMainId); FieldByName('SubId').value := Trim(FSubId); FieldByName('FromMainId').value := Trim(FMainId); FieldByName('FromSubId').value := Trim(FSubId); FieldByName('APId').value := Trim(FAPID); FieldByName('MJID').Value := Trim(maxno); FieldByName('MJStr2').Value := '已入库'; FieldByName('RKOrdID').Value := Trim(FAPID); FieldByName('MJMF').Value := Trim(MJMF.Text); FieldByName('MJKZ').Value := Trim(MJKZ.Text); FieldByName('MJstr4').Value := Trim(MJstr4.Text); //本厂缸号 FieldByName('mjxh').Value := strtointdef(trim(mjxh.Text), 0); FieldByName('JYXH').Value := trim(JYXH.Text); FieldByName('JYGH').Value := trim(lblMPRTSpec.Caption); FieldByName('MJTypeOther').Value := Trim(Label9.Caption); //长度 手输空加判断 // if Ekjlen.Text='' then // begin FieldByName('KongJia').Value := FKongJia; FieldByName('MJLen').Value := StrToFloatdef(trim(MJLen.Text), 0) + FKongJia - StrToFloatdef(Trim(Ekjlen.Text), 0); // end else // begin // FieldByName('KongJia').Value := StrToFloatdef(Trim(Ekjlen.Text),0); // FieldByName('MJLen').Value := StrToFloatdef(trim(MJLen.Text), 0) - StrToFloatdef(Trim(Ekjlen.Text),0); // end; //皮重 FieldByName('MJQty3').Value := StrToFloatdef(trim(MJQty3.Text), 0); // 毛重 if FOperationStatus = '重新扫描' then begin FieldByName('MJMaoZ').Value := RoundFloat((StrToFloatdef(trim(MJMaoZ.Text), 0)), 1); FieldByName('MJQty3').Value := 0; FieldByName('MJQty4').Value := RoundFloat((StrToFloatdef(trim(MJMaoZ.Text), 0)), 1); end else begin FieldByName('MJMaoZ').Value := RoundFloat((StrToFloatdef(trim(MJMaoZ.Text), 0) + FBaoZhuangDai + FKongJiaWei), 1); FieldByName('MJQty3').Value := 0; FieldByName('MJQty4').Value := RoundFloat((StrToFloatdef(trim(MJMaoZ.Text), 0) + FKongJiaWei), 1); end; FieldByName('KongJiaWei').Value := FKongJiaWei; //净重 FieldByName('MJQty4').Value := StrToFloatdef(trim(MJMaoZ.Text), 0) - StrToFloatdef(trim(MJQty3.Text), 0); //系数 FieldByName('MKXS').Value := StrToFloatdef(trim(MKXS.Text), 0); FieldByName('MJBanZu').Value := MJBanZu.Text; FieldByName('KuangHao').Value := KuangHao.Text; FieldByName('KuWei').Value := KuWei.Text; FieldByName('baoNO').Value := ''; FieldByName('baoID').Value := ''; if Trim(Edit3.Text) <> '' then begin FieldByName('MJType').Value := '正品'; end; if Trim(Edit4.Text) <> '' then begin FieldByName('MJType').Value := '次品'; end; if Trim(FMJID) = '' then begin FieldByName('Filler').Value := Trim(DName); end else begin FieldByName('Editer').Value := Trim(DName); FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp); end; //检验机台号 if Trim(SCXFlag) <> '' then begin FieldByName('JTType').Value := Trim(SCXFlag); end; FieldByName('MJTypeOther').Value := Trim(Label9.Caption); Post; end; if Trim(edtJH.Text) = '' then begin if FOperationStatus = '扫描流程卡' then begin with ADOCmd do begin Close; sql.Clear; sql.Add('update WFB_MJJY SET mjxh=1+isnull((select cast (max(mjxh) as int) from WFB_MJJY X where X.subID=WFB_MJJY.subID and X.JYXH=WFB_MJJY.JYXH and X.APID=WFB_MJJY.APID and X.MJID<>WFB_MJJY.MJID and X.MJType =''正品''),0)'); sql.Add('where MJID=''' + Trim(maxno) + ''''); // ShowMessage(SQL.Text); execsql; end; end; end; //将次品的卷号改为0 with ADOCmd do begin Close; sql.Clear; sql.Add('update WFB_MJJY SET mjxh=0 '); sql.Add('where MJType =''次品'' and MJID=''' + Trim(maxno) + ''''); execsql; end; //查询卷号修改界面 with ADOCmd do begin Close; sql.Clear; sql.Add('select MJXH from WFB_MJJY'); sql.Add('where MJID=''' + Trim(maxno) + ''''); // SQL.Add('and JYXH='''+Trim(JYXH.Text)+''''); open; if not IsEmpty then begin MJXH.Text := fieldbyname('mjxh').AsString; end; end; FMJID := Trim(maxno); FFFMJID := Trim(maxno); ///保存母卷疵点表 with CDS_MJCD do begin First; while not Eof do begin if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then begin if GetLSNo(ADOTmp, maxno, 'MC', 'WFB_MJJY_CD', 5, 1) = False then begin ADOCmd.Connection.RollbackTrans; Application.MessageBox('取子流水号失败!', '提示', 0); Exit; end; end else begin maxno := Trim(CDS_MJCD.fieldbyname('MCID').AsString); end; with ADOCmd do begin Close; SQL.Clear; sql.Add('select * from WFB_MJJY_CD '); sql.Add(' where MCID=''' + Trim(maxno) + ''''); Open; end; with ADOCmd do begin if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then Append else Edit; FieldByName('MJId').Value := Trim(FMJID); FieldByName('MCID').Value := Trim(maxno); SSetSaveDataCDSNew(ADOCmd, Tv2, CDS_MJCD, 'WFB_MJJY_CD', 0); FieldByName('KouFenType').Value := CDS_MJCD.fieldbyname('KouFenType').Value; Post; end; CDS_MJCD.Edit; CDS_MJCD.FieldByName('MCID').Value := Trim(maxno); Next; end; end; with ADOCmd do begin close; sql.Clear; sql.Add('update WFB_MJJY SET CDList= dbo.F_Get_Order_SubStr(MJID,''MJCDHZSL'')'); sql.Add('where MJID=''' + Trim(FMJID) + ''' '); execsql; end; //出入库及库存 with ADOCmd do begin Close; sql.Clear; sql.Add('exec P_Do_JYCRK @MJID=''' + trim(FMJID) + ''''); execsql; end; // raise Exception.Create('抛出异常'); // with ADOCmd do // begin // Close; // sql.Clear; // sql.Add('select a.* from CK_BanCP_CR a where CRFlag='''+'待入库'+''' and MJID=''' + trim(FMJID) + ''''); // execsql; // end; with ADOCmd do begin Close; sql.Clear; sql.Add('update CK_BanCP_CR set '); sql.Add('CRFlag=''' + '入库' + ''''); sql.Add(',CRType=''' + '检验入库' + ''''); sql.Add(',CRTime=getdate()'); sql.Add(',RKOrdID=''' + Trim(FAPID) + ''''); sql.Add(',JYXH=''' + trim(JYXH.Text) + ''''); sql.Add(',JYGH=''' + trim(lblMPRTSpec.Caption) + ''''); sql.Add('where MJID=''' + trim(FMJID) + ''''); sql.Add(' and CRFlag=''' + '待入库' + ''''); execsql; end; //更新开卡 with ADOCmd do begin Close; sql.Clear; sql.Add('exec P_UPdate_LCKJY @CarNo=''' + trim(FAPID) + ''''); execsql; end; InitCDGridID(); ADOCmd.Connection.CommitTrans; Result := True; except Result := False; ADOCmd.Connection.RollbackTrans; Application.MessageBox('保存失败!', '提示', 0); BTPrint.enabled := true; end; end; procedure TfrmMarkingInspection.PrtData(FMJID: string); var fPrintFile: string; Txt, fImagePath: string; Moudle: THandle; Makebar: TMakebar; Mixtext: TMixtext; begin with ADOQueryPrint do begin Close; SQL.Clear; sql.Add(' EXEC P_Print_JYLab '); SQL.Add(' @MJID=''' + Trim(FMJID) + ''''); Open; end; if ADOQueryPrint.IsEmpty then begin application.MessageBox('标签内容未找到!', '提示信息', MB_ICONERROR); exit; end; try Moudle := LoadLibrary('MakeQRBarcode.dll'); @Makebar := GetProcAddress(Moudle, 'Make'); @Mixtext := GetProcAddress(Moudle, 'MixText'); Txt := Trim(ADOQueryPrint.fieldbyname('MJID').AsString); fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp'; if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil); if FileExists(fImagePath) then DeleteFile(fImagePath); Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3); except application.MessageBox('条形码生成失败!', '提示信息', MB_ICONERROR); exit; end; ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('LBName').AsString) + '.rmf', ADOTmp); if Trim(ADOQueryPrint.fieldbyname('LBName').AsString) <> '' then begin fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('LBName').AsString) + '.rmf' end else begin ExportFtErpFile('通用英文标签.rmf', ADOTmp); fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\通用英文标签.rmf'; end; if FileExists(fPrintFile) then begin RMVariables['QRBARCODE'] := fImagePath; RM2.LoadFromFile(fPrintFile); Rm2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1); RM2.PrintReport; end else begin Application.MessageBox(PChar('没有找' + fPrintFile), '提示', 0); end; end; procedure TfrmMarkingInspection.SpeedButton1Click(Sender: TObject); var fsj: string; begin fsj := Trim(TSpeedButton(Sender).Hint); if Trim(fsj) = '' then Exit; if TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).ReadOnly = False then begin fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text); TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := fsj + Trim(TSpeedButton(Sender).Caption); TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll; end; end; procedure TfrmMarkingInspection.SpeedButton12Click(Sender: TObject); var fsj: string; begin fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text); if Trim(fsj) = '' then Exit; if TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).ReadOnly = False then begin TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := Copy(fsj, 1, Length(fsj) - 1); TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll; end; end; procedure TfrmMarkingInspection.SpeedButton13Click(Sender: TObject); var i: Integer; begin if CheckData('疵点') = False then exit; FCDName := Trim(TSpeedButton(Sender).Hint); MovePanel1.Visible := True; Label21.Caption := Trim(FCDName); //显示数字键盘 Edit1.SetFocus; Panel3.Visible := True; with Panel3 do begin for i := 0 to ControlCount - 1 do begin if Controls[i] is TSpeedButton then begin TSpeedButton(Controls[i]).Hint := Trim(Edit1.Name); end; end; end; end; procedure TfrmMarkingInspection.cxGridDBColumn2PropertiesChange(Sender: TObject); var fsj: string; begin fsj := Trim(Order_MJ.fieldbyname('SubId').AsString); Order_MJ.DisableControls; with Order_MJ do begin First; while not Eof do begin if Trim(Order_MJ.fieldbyname('SubId').AsString) <> fsj then begin Edit; FieldByName('SSel').Value := False; end; Next; end; end; Order_MJ.EnableControls; Order_MJ.Locate('SubId', fsj, []); end; procedure TfrmMarkingInspection.Button1Click(Sender: TObject); var mvalue: Double; begin { if Trim(Edit1.Text)='' then begin Application.MessageBox('位置不能为空!','提示',0); exit; end; } if Trim(Edit1.Text) <> '' then begin if Trim(Edit2.Text) <> '' then begin if StrToFloat(Edit2.Text) < StrToFloat(Edit1.Text) then begin Application.MessageBox('疵点位置录入错误!', '提示', 0); Exit; end; end; end; if CDQty.Text <> '' then begin if TryStrToFloat(CDQty.Text, mvalue) = False then begin Application.MessageBox('非法数字!', '提示', 0); Exit; end; end; with CDS_MJCD do begin Append; FieldByName('cdname').Value := Trim(FCDName); FieldByName('CDbeg').Value := Trim(Edit1.Text); FieldByName('CDEnd').Value := Trim(Edit2.Text); FieldByName('KouFenQty').Value := 0; if RadioGroup1.ItemIndex > -1 then FieldByName('KouFenType').Value := RadioGroup1.Items.Strings[RadioGroup1.ItemIndex]; if RadioGroup1.ItemIndex > -1 then begin if RadioGroup1.ItemIndex < 3 then begin FieldByName('KouFenQty').Value := RadioGroup1.ItemIndex + 1; end else begin FieldByName('KouFenQty').Value := 4; end; end; if Trim(FCDName) = '测幅宽' then FieldByName('KouFenQty').Value := 0; FieldByName('CDQty').Value := StrToFloatdef(trim(CDQty.Text), 0); {if Trim(Edit2.Text)<>'' then begin FieldByName('CDQty').Value:=StrToFloat(Edit2.Text)-StrToFloat(Edit1.Text); end else begin FieldByName('CDQty').Value:=0; end; } Post; end; Edit1.Text := ''; Edit2.Text := ''; CDQty.Text := ''; MovePanel1.Visible := False; Panel3.Visible := False; end; procedure TfrmMarkingInspection.ToolButton1Click(Sender: TObject); begin InitJP(); end; procedure TfrmMarkingInspection.Button5Click(Sender: TObject); var fPrintFile: string; i: Integer; mvalue: Double; begin if CDS_MJID.IsEmpty then Exit; PrtData(CDS_MJID.fieldbyname('MJID').AsString); end; procedure TfrmMarkingInspection.SpeedButton49Click(Sender: TObject); begin Panel3.Visible := False; end; procedure TfrmMarkingInspection.APIDKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin ClearGlobal(); if edtDel.Text = '√' then begin DelData(Trim(APID.Text)); end else begin if Copy(Trim(APID.Text), 1, 2) = 'CZ' then begin FAPID := Trim(APID.Text); APID.Text := ''; FOperationStatus := '扫描流程卡'; InitLCK(); end else begin FFFMJID := Trim(APID.Text); APID.Text := ''; FOperationStatus := '扫描卷条码'; InitJYXX(); end; end; MJMaoZ.SetFocus; end; end; procedure TfrmMarkingInspection.Edit1Click(Sender: TObject); var i: Integer; begin Panel3.Visible := True; with Panel3 do begin for i := 0 to ControlCount - 1 do begin if Controls[i] is TSpeedButton then begin TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name); end; end; end; end; procedure TfrmMarkingInspection.Edit2Change(Sender: TObject); var mvalue: Double; begin if Trim(Edit1.Text) <> '' then begin if TryStrToFloat(Edit1.Text, mvalue) = False then begin Application.MessageBox('非法数字!', '提示', 0); Exit; end; end else begin Exit; end; if Trim(Edit2.Text) <> '' then begin if TryStrToFloat(Edit2.Text, mvalue) = False then begin Application.MessageBox('非法数字!', '提示', 0); Exit; end; end else begin Exit; end; CDQty.Text := FloatToStr(StrToFloat(Edit2.Text) - StrToFloat(Edit1.Text)); end; procedure TfrmMarkingInspection.Edit3Click(Sender: TObject); begin if Trim(Edit3.Text) = '' then begin Edit3.Text := '√'; Edit4.Text := ''; end else begin Edit3.Text := ''; Edit4.Text := '√'; end; end; procedure TfrmMarkingInspection.Edit4Click(Sender: TObject); begin if Trim(Edit4.Text) = '' then begin Edit4.Text := '√'; Edit3.Text := ''; end else begin Edit4.Text := ''; Edit3.Text := '√'; end; end; procedure TfrmMarkingInspection.Edit6Click(Sender: TObject); begin if Trim(Edit6.Text) = '' then begin Edit6.Text := '√'; end else begin Edit6.Text := ''; end; end; procedure TfrmMarkingInspection.MJstr3KeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin Key := #0; SelectNext(ActiveControl as TWinControl, True, True); end; end; procedure TfrmMarkingInspection.Label9Click(Sender: TObject); begin if trim(Label9.Caption) = 'M' then begin Label9.Caption := 'Y'; Label19.Caption := 'Y'; Label20.Caption := 'Y'; Label7.Caption := 'Y'; end else begin Label9.Caption := 'M'; Label19.Caption := 'M'; Label20.Caption := 'M'; Label7.Caption := 'M'; end; end; procedure TfrmMarkingInspection.MJQty4Exit(Sender: TObject); begin if (trim(MJMaoZ.Text) = '') and (trim(MJQty4.Text) = '') then exit; if (trim(MJMaoZ.Text) = '') and (trim(MJQty3.Text) = '') then exit; if (trim(MJQty4.Text) = '') and (trim(MJQty3.Text) = '') then exit; if (trim(MJQty3.Text) = '') then exit; if (trim(MJQty4.Text) <> '') then begin MJMaoZ.Text := floattostr(strtofloatdef(trim(MJQty3.Text), 0) + strtofloatdef(trim(MJQty4.Text), 0)); exit; end; end; procedure TfrmMarkingInspection.Button2Click(Sender: TObject); begin RadioGroup1.ItemIndex := -1; end; procedure TfrmMarkingInspection.MJQty4Change(Sender: TObject); var FReal: Double; begin if strtofloatdef(trim(MKXS.Text), 0) <> 0 then begin MJLen.Text := format('%.1f', [StrToFloatdef(trim(MJQty4.Text), 0) * StrToFloatdef(trim(MKXS.Text), 0)]); end; end; procedure TfrmMarkingInspection.MJMaoZChange(Sender: TObject); var FReal: Double; begin if Trim(MJMaoZ.Text) = '' then begin MJQty4.Text := ''; Exit; end; if TryStrToFloat(MJMaoZ.Text, FReal) = False then Exit; if Trim(MJQty3.Text) <> '' then begin if TryStrToFloat(MJQty3.Text, FReal) = False then Exit; MJQty4.Text := FloatToStr(StrToFloat(MJMaoZ.Text) - StrToFloat(MJQty3.Text)); end else begin MJQty4.Text := MJMaoZ.Text; end; if strtofloatdef(trim(MKXS.Text), 0) <> 0 then begin MJLen.Text := format('%.1f', [StrToFloatdef(trim(MJQty4.Text), 0) * StrToFloatdef(trim(MKXS.Text), 0)]); end; end; procedure TfrmMarkingInspection.APIDClick(Sender: TObject); var i: Integer; begin Panel3.Visible := True; with Panel3 do begin for i := 0 to ControlCount - 1 do begin if Controls[i] is TSpeedButton then begin TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name); end; end; end; end; procedure TfrmMarkingInspection.Edit7Click(Sender: TObject); begin if Trim(Edit7.Text) = '' then begin Edit7.Text := '√'; end else begin Edit7.Text := ''; end; end; procedure TfrmMarkingInspection.MJQty4KeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin BTPrint.Click; end; end; procedure TfrmMarkingInspection.FormCreate(Sender: TObject); begin IsCommopen := false; IsJsMessage := false; end; procedure TfrmMarkingInspection.Edit8Click(Sender: TObject); begin if Trim(Edit8.Text) = '' then begin Edit8.Text := '√'; Button5.Visible := true; end else begin Edit8.Text := ''; Button5.Visible := false; end; end; procedure TfrmMarkingInspection.Tv3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean); var FMJLen, FMJMaoZ: Double; begin FMJLen := AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('MJLen').Index]; FMJMaoZ := AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('MJMaoZ').Index]; if (FMJLen < 10) or (FMJLen > 200) then begin ACanvas.Brush.Color := clRed; end; if (FMJMaoZ < 5) or (FMJMaoZ > 40) then begin ACanvas.Brush.Color := clRed; end end; procedure TfrmMarkingInspection.ToolButton3Click(Sender: TObject); var SRKOrdID, strsql: string; begin ToolButton3.Enabled := false; if Trim(FAPID) = '' then begin Application.MessageBox('请扫描流程卡!', '提示', 0); Exit; end; if Trim(FMainId) = '' then begin Application.MessageBox('请扫描流程卡!', '提示', 0); Exit; end; if Trim(FSubId) = '' then begin Application.MessageBox('请扫描流程卡!', '提示', 0); Exit; end; if Application.MessageBox('是否核实好数据', '提示', 32 + 4) <> IDYES then begin ToolButton3.Enabled := true; Exit; end; if GetLSNo(ADOTmp, SRKOrdID, 'RK', 'CK_BanCP_CR', 4, 1) = False then begin Application.MessageBox('生成流水号异常!', '提示', 0); exit; end; try ADOCmd.Connection.BeginTrans; with Self.ADOCmd do begin Close; sql.Clear; sql.Add('UPDATE CK_BanCP_CR Set '); sql.add('RKOrdID=' + quotedstr(trim(SRKOrdID))); sql.Add(' where CK_BanCP_CR.APID=' + quotedstr(trim(FAPID))); sql.Add(' and CK_BanCP_CR.MainId=' + quotedstr(trim(FMainId))); sql.Add(' and CK_BanCP_CR.SubId=' + quotedstr(trim(FSubId))); sql.Add(' and CK_BanCP_CR.CRFlag=''待入库'' '); sql.Add('UPDATE CK_BanCP_CR Set '); sql.add(' CRTime=getdate(),CRType=''检验入库'',CRFlag=''入库'' '); sql.Add(' where CK_BanCP_CR.APID=' + quotedstr(trim(FAPID))); sql.Add(' and CK_BanCP_CR.MainId=' + quotedstr(trim(FMainId))); sql.Add(' and CK_BanCP_CR.SubId=' + quotedstr(trim(FSubId))); sql.Add(' and CK_BanCP_CR.CRFlag=''待入库'' '); sql.Add('UPDATE WFB_MJJY Set '); sql.add('RKOrdID=' + quotedstr(trim(SRKOrdID)) + ' ,MJStr2=''已入库'' '); sql.Add(' where WFB_MJJY.APID=' + quotedstr(trim(FAPID))); sql.Add(' and WFB_MJJY.MainId=' + quotedstr(trim(FMainId))); sql.Add(' and WFB_MJJY.SubId=' + quotedstr(trim(FSubId))); SQL.Add('and WFB_MJJY.MJStr2=''未入库'' '); ExecSQL; end; ADOCmd.Connection.CommitTrans; PrintCKMDG(Trim(SRKOrdID)); except ADOCmd.Connection.RollbackTrans; ToolButton3.Enabled := true; application.MessageBox('数据撤销失败!', '提示信息', 0); end; ToolButton3.Enabled := true; end; procedure TfrmMarkingInspection.ToolButton2Click(Sender: TObject); var SRKOrdID: string; begin with ADOTmp do begin Close; sql.Clear; sql.Add('select top 1 RKOrdID from CK_BanCP_CR where CRFlag=''入库'' '); sql.Add('and APID=' + quotedstr(Trim(FAPID))); Open; end; if not ADOTmp.IsEmpty then begin PrintCKMDG(Trim(ADOTmp.fieldbyname('RKOrdID').AsString)); end; end; procedure TfrmMarkingInspection.Tv3DblClick(Sender: TObject); begin // DelData(Trim(CDS_MJID.fieldbyname('MJID').AsString)); end; procedure TfrmMarkingInspection.Button3Click(Sender: TObject); begin try frmKuangHaoSel := TfrmKuangHaoSel.Create(self); with frmKuangHaoSel do begin FlagStr := 'KuWei'; if ShowModal = 1 then begin KuWei.Text := frmKuangHaoSel.FSDPerson; end; end; finally frmKuangHaoSel.Free; end; end; procedure TfrmMarkingInspection.ToolButton4Click(Sender: TObject); begin try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := 'KuWei'; flagname := '库位管理'; if ShowModal = 1 then begin Self.InitJP(); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmMarkingInspection.edtDelClick(Sender: TObject); begin if Trim(TEdit(Sender).Text) = '' then begin TEdit(Sender).Text := '√'; end else begin TEdit(Sender).Text := ''; end; end; procedure TfrmMarkingInspection.Button6Click(Sender: TObject); begin fxjno := 0; Ekjlen.Text := fxjjc[fxjno]; end; procedure TfrmMarkingInspection.MJBanZuChange(Sender: TObject); begin InitCDGridID(); with ADOTmp do begin Close; sql.Clear; sql.Add('select B.Glidename'); sql.Add(',maxroll=(select max(mjXH) from WFB_MJJY X where X.APID=A.CARNO and X.JYXH=B.Glidename)+1'); sql.Add('from JYOrder_car A '); sql.Add('inner join JYOrder_Glide B on A.carno=B.carno '); sql.Add('where A.CarNo=' + quotedstr(Trim(FAPID))); sql.Add('and B.Glidename=' + quotedstr(Trim(JYXH.Text))); // showmessage(SQL.text); Open; end; if ADOTmp.IsEmpty = False then begin if ADOTmp.fieldbyname('maxRoll').AsString <> '' then begin MJXH.Text := Trim(ADOTmp.fieldbyname('maxRoll').AsString); end else begin MJXH.Text := '1'; end; end; end; procedure TfrmMarkingInspection.SpeedButton19Click(Sender: TObject); var fPrintFile: string; mvalue: Double; i: Integer; key: Char; begin BTPrint.enabled := false; APID.SetFocus; with ADOTmp do begin Close; sql.Clear; sql.Add('select B.Glidename,SYPS=A.RollNum-(select count(mjid) from WFB_MJJY X where X.APID=A.CARNO)'); sql.Add(',SYXHPS=B.MXPS-(select count(mjid) from WFB_MJJY X where X.APID=A.CARNO and X.JYXH=B.Glidename)'); sql.Add('from JYOrder_car A '); sql.Add('inner join JYOrder_Glide B on A.carno=B.carno '); sql.Add('where A.CarNo=' + quotedstr(Trim(FAPID))); // showmessage(SQL.text); Open; end; // showmessage(Fkaipi); if Fkaipi <> '是' then begin if ADOTmp.Locate('Glidename', Trim(JYXH.Text), []) then begin // showmessage(ADOTmp.FieldByName('SYXHPS').Asstring); // showmessage(ADOTmp.FieldByName('SYPS').Asstring); if ADOTmp.FieldByName('SYXHPS').AsInteger <= 0 then begin if Application.MessageBox('超出当前缸号数量', '提示', 32 + 4) <> IDYES then begin // if ADOTmp.FieldByName('SYPS').AsInteger <= 0 then // begin BTPrint.enabled := true; Exit; // end; end else begin FMMF := 1; mima1.Caption := '检验匹数超出开卡匹数'; mima2.Caption := '继续提交需确认密码'; Panel4.Visible := True; BTPrint.enabled := true; Exit; end; end; if ADOTmp.FieldByName('SYPS').AsInteger <= 0 then begin FMMF := 1; mima1.Caption := '检验匹数超出开卡匹数'; mima2.Caption := '继续提交需确认密码'; Panel4.Visible := True; BTPrint.enabled := true; Exit; end; end else begin with ADOTmp do begin Close; sql.Clear; sql.Add('select SYPS=A.RollNum-(select count(mjid) from WFB_MJJY X where X.APID=A.CARNO)'); // sql.Add(',SYXHPS=B.MXPS-(select count(mjid) from WFB_MJJY X where X.APID=A.CARNO and X.JYXH=B.Glidename)'); sql.Add('from JYOrder_car A '); // sql.Add('inner join JYOrder_Glide B on A.carno=B.carno '); sql.Add('where A.CarNo=' + quotedstr(Trim(FAPID))); // showmessage(SQL.text); Open; end; if ADOTmp.FieldByName('SYPS').AsInteger <= 0 then begin FMMF := 1; mima1.Caption := '检验匹数超出开卡匹数'; mima2.Caption := '继续提交需确认密码'; Panel4.Visible := True; BTPrint.enabled := true; Exit; end; end; end; // if ADOTmp.FieldByName('SYPS').AsInteger <= 0 then // begin // Panel4.Visible:=True; // Exit; //// if Application.MessageBox('检验匹数超出开卡匹数是否继续提交', '提示', 32 + 4) <> IDYES then //// begin //// Exit; //// end; // end; if CheckData('提交') = False then begin BTPrint.enabled := true; exit; end; if SaveData() then begin // MJMF.Text := ''; // MJKZ.Text := ''; MJLen.Text := ''; MJMaoZ.Text := ''; MJQty4.Text := ''; Edit3.Text := '√'; Edit4.Text := ''; //更新减长 fxjno := fxjno + 1; if fxjno < xjint then begin Ekjlen.Text := fxjjc[fxjno]; end; // Ekjlen.Text := ''; // Ekjwei.Text := ''; MJXH.Text := inttostr(strTointdef(trim(MJXH.Text), 0) + 1); if Trim(Edit6.Text) = '√' then begin PrtData(FFFMJID); end; end; FFFMJID := ''; InitCDGrid(); MJMaoZ.SetFocus; MJMaoZ.OnClick(MJMaoZ); if FOperationStatus = '重新扫描' then begin FOperationStatus := ''; APID.Text := Trim(FAPID); APIDKeyPress(APID, key); end; BTPrint.enabled := true; end; procedure TfrmMarkingInspection.edtJHClick(Sender: TObject); begin if Trim(TEdit(Sender).Text) = '' then begin TEdit(Sender).Text := '√'; mjxh.ReadOnly := False; end else begin TEdit(Sender).Text := ''; mjxh.ReadOnly := True; end; end; procedure TfrmMarkingInspection.ToolButton5Click(Sender: TObject); begin if ScrollBox1.Visible then begin ScrollBox1.Visible := False; Panel7.Visible := False; end else begin ScrollBox1.Visible := True; Panel7.Visible := True; end; end; procedure TfrmMarkingInspection.ToolButton6Click(Sender: TObject); begin if CDS_MJID.IsEmpty then Exit; if CDS_MJID.fieldbyname('filler').AsString <> Trim(DName) then begin ShowMessage('不能删除他人的数据'); exit; end; // if Fkaipi='是' then // begin FMMF := 2; mima1.Caption := '是否要删除此卷'; mima2.Caption := Trim(CDS_MJID.fieldbyname('MJID').AsString); Panel4.Visible := True; // end // else // begin // DelData(Trim(CDS_MJID.fieldbyname('MJID').AsString)); // with ADOTmp do // begin // Close; // sql.Clear; // sql.Add('select B.Glidename'); // sql.Add(',maxroll=(select max(mjXH) from WFB_MJJY X where X.APID=A.CARNO and X.JYXH=B.Glidename)+1'); // sql.Add('from JYOrder_car A '); // sql.Add('inner join JYOrder_Glide B on A.carno=B.carno '); // sql.Add('where A.CarNo=' + quotedstr(Trim(FAPID))); // sql.Add('and B.Glidename=' + quotedstr(Trim(JYXH.Text))); // // showmessage(SQL.text); // Open; // end; // if ADOTmp.IsEmpty = False then // begin // // MJXH.Text := Trim(ADOTmp.fieldbyname('maxRoll').AsString); // end; // end; end; procedure TfrmMarkingInspection.Button4Click(Sender: TObject); begin movePanel1.Visible := False; end; procedure TfrmMarkingInspection.ToolButton7Click(Sender: TObject); begin try ADOCmd.Connection.BeginTrans; with CDS_LCKHZ do begin First; while not Eof do begin with ADOCmd do begin Close; sql.Clear; sql.Add('UPDATE WFB_MJJY Set ISXD=1'); sql.Add(' where APID=' + quotedstr(trim(CDS_LCKHZ.FieldByName('APID').AsString))); ExecSQL; end; Next; end; end; ADOCmd.Connection.CommitTrans; except ADOCmd.Connection.RollbackTrans; application.MessageBox('数据清空失败!', '提示信息', 0); end; CDS_LCKHZ.EmptyDataSet; end; procedure TfrmMarkingInspection.Edit9Click(Sender: TObject); begin if Trim(Edit9.Text) = '' then begin Edit9.Text := '√'; end else begin Edit9.Text := ''; end; end; procedure TfrmMarkingInspection.JYXHClick(Sender: TObject); begin InitCDGridID(); with ADOTmp do begin Close; sql.Clear; sql.Add('select B.Glidename'); sql.Add(',maxroll=(select max(mjXH) from WFB_MJJY X where X.APID=A.CARNO and X.JYXH=B.Glidename)+1'); sql.Add('from JYOrder_car A '); sql.Add('inner join JYOrder_Glide B on A.carno=B.carno '); sql.Add('where A.CarNo=' + quotedstr(Trim(FAPID))); sql.Add('and B.Glidename=' + quotedstr(Trim(JYXH.Text))); // showmessage(SQL.text); Open; end; if ADOTmp.IsEmpty = False then begin if ADOTmp.fieldbyname('maxRoll').AsString <> '' then begin MJXH.Text := Trim(ADOTmp.fieldbyname('maxRoll').AsString); end else begin MJXH.Text := '1'; end; end; end; procedure TfrmMarkingInspection.ToolButton8Click(Sender: TObject); var MMJID: string; FSMIS, Fopevent: string; begin MMJID := Trim(CDS_MJID.fieldbyname('MJID').AsString); if CDS_MJID.IsEmpty then Exit; if Application.MessageBox('确定要修改卷号吗', '提示', 32 + 4) <> IDYES then Exit; if CDS_MJID.Locate('MJID', MMJID, []) then begin Fopevent := '卷条码:' + trim(MMJID) + ' 卷号:' + Trim(CDS_MJID.fieldbyname('MJXH').AsString); end else begin Application.MessageBox('无法找到该布匹!', '提示', 0); Exit; end; with ADOTmp do begin Close; sql.Clear; sql.Add('select * from CK_BanCP_CR where MJID=''' + Trim(MMJID) + ''' and CRFlag=''出库'''); Open; end; if ADOTmp.IsEmpty = False then begin Application.MessageBox('已产生出库数据不能删除!', '提示', 0); Exit; end; try CDS_MJID.DisableControls; ADOQueryMain.Connection.BeginTrans; with ADOQueryMain do begin with ADOQueryMain do begin Close; sql.Clear; sql.Add('Update WFB_MJJY Set MJXH=''' + trim(MJXH.Text) + ''' '); sql.Add('where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + ''''); sql.Add('Update CK_BanCP_CR Set MJXH=''' + trim(MJXH.Text) + ''' '); sql.Add('where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + ''''); ExecSQL; end; end; ADOQueryMain.Connection.CommitTrans; CDS_MJID.EnableControls; application.MessageBox('数据保存成功!', '提示信息'); PrtData(Trim(CDS_MJID.fieldbyname('MJID').AsString)); InitCDGridID(); exit; except ADOQueryMain.Connection.RollbackTrans; CDS_MJID.EnableControls; application.MessageBox('数据保存失败!', '提示信息', 0); end; end; procedure TfrmMarkingInspection.Button8Click(Sender: TObject); begin Panel4.Visible := false; Edit10.Text := ''; end; procedure TfrmMarkingInspection.Button7Click(Sender: TObject); var fPrintFile: string; mvalue: Double; i: Integer; key: Char; begin Button7.enabled := false; try if FMMF = 1 then begin if Edit10.Text = '110' then begin if CheckData('提交') = False then exit; if SaveData() then begin // MJMF.Text := ''; // MJKZ.Text := ''; MJLen.Text := ''; MJMaoZ.Text := ''; MJQty4.Text := ''; Edit3.Text := '√'; Edit4.Text := ''; //更新减长 fxjno := fxjno + 1; if fxjno < xjint then begin Ekjlen.Text := fxjjc[fxjno]; end; // Ekjwei.Text := ''; MJXH.Text := inttostr(strTointdef(trim(MJXH.Text), 0) + 1); if Trim(Edit6.Text) = '√' then begin PrtData(FFFMJID); end; end; FFFMJID := ''; InitCDGrid(); MJMaoZ.SetFocus; MJMaoZ.OnClick(MJMaoZ); if FOperationStatus = '重新扫描' then begin FOperationStatus := ''; APID.Text := Trim(FAPID); APIDKeyPress(APID, key); end; Panel4.Visible := false; Edit10.Text := ''; end else begin Edit10.Text := ''; ShowMessage('密码错误'); end; end else if FMMF = 2 then begin if Edit10.Text = '110' then begin DelData(Trim(mima2.Caption)); with ADOTmp do begin Close; sql.Clear; sql.Add('select B.Glidename'); sql.Add(',maxroll=(select max(mjXH) from WFB_MJJY X where X.APID=A.CARNO and X.JYXH=B.Glidename)+1'); sql.Add('from JYOrder_car A '); sql.Add('inner join JYOrder_Glide B on A.carno=B.carno '); sql.Add('where A.CarNo=' + quotedstr(Trim(FAPID))); sql.Add('and B.Glidename=' + quotedstr(Trim(JYXH.Text))); // showmessage(SQL.text); Open; end; if ADOTmp.IsEmpty = False then begin MJXH.Text := Trim(ADOTmp.fieldbyname('maxRoll').AsString); end; Panel4.Visible := false; Edit10.Text := ''; end else begin Edit10.Text := ''; ShowMessage('密码错误'); end; end; finally Button7.enabled := true; end; end; procedure TfrmMarkingInspection.MJQty3Change(Sender: TObject); var FReal: Double; begin if Trim(MJMaoZ.Text) = '' then begin MJQty4.Text := ''; Exit; end; if TryStrToFloat(MJMaoZ.Text, FReal) = False then Exit; if Trim(MJQty3.Text) <> '' then begin if TryStrToFloat(MJQty3.Text, FReal) = False then Exit; MJQty4.Text := FloatToStr(StrToFloat(MJMaoZ.Text) - StrToFloat(MJQty3.Text)); end else begin MJQty4.Text := MJMaoZ.Text; end; if strtofloatdef(trim(MKXS.Text), 0) <> 0 then begin MJLen.Text := format('%.1f', [StrToFloatdef(trim(MJQty4.Text), 0) * StrToFloatdef(trim(MKXS.Text), 0)]); end; end; end.