diff --git a/A05基础资料管ç�†/U_MachineManage.dfm b/A05基础资料管ç�†/U_MachineManage.dfm index 106ab31..5eba3d2 100644 --- a/A05基础资料管ç�†/U_MachineManage.dfm +++ b/A05基础资料管ç�†/U_MachineManage.dfm @@ -17,7 +17,7 @@ inherited frmMachineManage: TfrmMachineManage Height = 38 AutoSize = True ButtonHeight = 38 - ButtonWidth = 91 + ButtonWidth = 97 Caption = 'ToolBar1' Color = clSkyBlue DisabledImages = DataLink_BaseInfo.ImageList_new32 @@ -88,12 +88,20 @@ inherited frmMachineManage: TfrmMachineManage Left = 497 Top = 0 AutoSize = True - Caption = #32465#23450#20135#21697 + Caption = #32465#23450#20135#21697'1' ImageIndex = 4 OnClick = tbBindProdClick end + object tbBindProd2: TToolButton + Left = 598 + Top = 0 + AutoSize = True + Caption = #32465#23450#20135#21697'2' + ImageIndex = 4 + OnClick = tbBindProd2Click + end object ToolButton3: TToolButton - Left = 592 + Left = 699 Top = 0 AutoSize = True Caption = #25171#21360 @@ -101,7 +109,7 @@ inherited frmMachineManage: TfrmMachineManage OnClick = ToolButton3Click end object ToolButton1: TToolButton - Left = 663 + Left = 770 Top = 0 AutoSize = True Caption = #23548#20986 @@ -109,7 +117,7 @@ inherited frmMachineManage: TfrmMachineManage OnClick = ToolButton1Click end object TBClose: TToolButton - Left = 734 + Left = 841 Top = 0 AutoSize = True Caption = #20851#38381 @@ -190,13 +198,37 @@ inherited frmMachineManage: TfrmMachineManage Width = 180 end object v2Column9: TcxGridDBColumn - Caption = #20135#21697#32534#21495 + Caption = #20135#21697#32534#21495'1' DataBinding.FieldName = 'C_CodeName' DataBinding.IsNullValueType = True PropertiesClassName = 'TcxTextEditProperties' HeaderAlignmentHorz = taCenter Width = 140 end + object Tv2C_Name: TcxGridDBColumn + Caption = #20135#21697#21517#31234'1' + DataBinding.FieldName = 'C_Name' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 150 + end + object v2Column10: TcxGridDBColumn + Caption = #20135#21697#32534#21495'2' + DataBinding.FieldName = 'C_CodeName2' + DataBinding.IsNullValueType = True + PropertiesClassName = 'TcxTextEditProperties' + HeaderAlignmentHorz = taCenter + Width = 140 + end + object Tv2C_Name2: TcxGridDBColumn + Caption = #20135#21697#21517#31234'2' + DataBinding.FieldName = 'C_Name2' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 150 + end end object cxGridLevel1: TcxGridLevel GridView = Tv2 @@ -303,5 +335,13 @@ inherited frmMachineManage: TfrmMachineManage Caption = #20840#24323 OnClick = N2Click end + object N3: TMenuItem + Caption = #35299#32465#20135#21697'1' + OnClick = N3Click + end + object N4: TMenuItem + Caption = #35299#32465#20135#21697'2' + OnClick = N4Click + end end end diff --git a/A05基础资料管ç�†/U_MachineManage.pas b/A05基础资料管ç�†/U_MachineManage.pas index 1480dcc..0af4354 100644 --- a/A05基础资料管ç�†/U_MachineManage.pas +++ b/A05基础资料管ç�†/U_MachineManage.pas @@ -36,6 +36,8 @@ type PopupMenu1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; + N3: TMenuItem; + N4: TMenuItem; Panel1: TPanel; MCNO: TEdit; v2Column8: TcxGridDBColumn; @@ -50,6 +52,10 @@ type tbStart: TToolButton; tbPause: TToolButton; tbBindProd: TToolButton; + tbBindProd2: TToolButton; + Tv2C_Name: TcxGridDBColumn; + v2Column10: TcxGridDBColumn; + Tv2C_Name2: TcxGridDBColumn; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure TBCloseClick(Sender: TObject); @@ -60,6 +66,8 @@ type procedure cxTabControl1Change(Sender: TObject); procedure N1Click(Sender: TObject); procedure N2Click(Sender: TObject); + procedure N3Click(Sender: TObject); + procedure N4Click(Sender: TObject); procedure CustomerChange(Sender: TObject); procedure FormCreate(Sender: TObject); procedure v2Column8PropertiesEditValueChanged(Sender: TObject); @@ -71,8 +79,11 @@ type procedure tbStartClick(Sender: TObject); procedure tbPauseClick(Sender: TObject); procedure tbBindProdClick(Sender: TObject); + procedure tbBindProd2Click(Sender: TObject); private { Private declarations } + procedure BindProduct(AFieldName, ALogAction: string); + procedure UnbindProduct(AFieldName, ALogAction: string); procedure InitGrid(); procedure EditValueT(); procedure EditValueF(); @@ -102,7 +113,11 @@ begin begin Close; SQL.Clear; - sql.Add(' select A.* from BS_Machine A '); +// sql.Add(' select A.* from BS_Machine A '); + sql.Add(' select A.*, ISNULL(B.C_Name,'''') as C_Name, ISNULL(C.C_Name,'''') as C_Name2 '); //nullת¿Õ×Ö·û´® + sql.Add(' from BS_Machine A '); + sql.Add(' left join Bs_Cloth_Info B on B.C_Code = A.C_CodeName '); + sql.Add(' left join Bs_Cloth_Info C on C.C_Code = A.C_CodeName2 '); if cxTabControl1.TabIndex = 1 then sql.Add(' where ISNULL(A.Status,0) = 5 '); sql.Add(' order by MCNO '); @@ -350,6 +365,16 @@ begin end; procedure TfrmMachineManage.tbBindProdClick(Sender: TObject); +begin + BindProduct('C_CodeName', '°ó¶¨²úÆ·1'); +end; + +procedure TfrmMachineManage.tbBindProd2Click(Sender: TObject); +begin + BindProduct('C_CodeName2', '°ó¶¨²úÆ·2'); +end; + +procedure TfrmMachineManage.BindProduct(AFieldName, ALogAction: string); var MMCIDS, MCodeName: string; begin @@ -403,7 +428,7 @@ begin begin Close; SQL.Clear; - SQL.Add('update BS_Machine set C_CodeName=' + QuotedStr(MCodeName)); + SQL.Add('update BS_Machine set ' + AFieldName + '=' + QuotedStr(MCodeName)); SQL.Add(' , Editer=''' + Trim(DName) + ''''); SQL.Add(' , Edittime=getdate()'); SQL.Add(' where MCID in (' + MMCIDS + ')'); @@ -417,7 +442,7 @@ begin SQL.Add(' ' + QuotedStr(Trim(DName))); SQL.Add(',getdate() '); SQL.Add(',' + QuotedStr(Trim(self.Caption))); - SQL.Add(',' + QuotedStr(Trim('°ó¶¨²úÆ·'))); + SQL.Add(',' + QuotedStr(Trim(ALogAction))); SQL.Add(',' + QuotedStr(Trim(MMCIDS + ' -> ' + MCodeName))); SQL.Add(',' + QuotedStr(Trim('³É¹¦'))); SQL.Add(')'); @@ -433,7 +458,7 @@ begin if CDS_HZ.fieldbyname('SSel').AsBoolean then begin CDS_HZ.Edit; - CDS_HZ.fieldbyname('C_CodeName').AsString := MCodeName; + CDS_HZ.fieldbyname(AFieldName).AsString := MCodeName; CDS_HZ.Post; end; CDS_HZ.Next; @@ -441,7 +466,7 @@ begin finally CDS_HZ.EnableControls; end; - + InitGrid(); Application.MessageBox('°ó¶¨³É¹¦£¡', 'ÌáʾÐÅÏ¢'); except ADOQueryCmd.Connection.RollbackTrans; @@ -449,6 +474,95 @@ begin end; end; +procedure TfrmMachineManage.UnbindProduct(AFieldName, ALogAction: string); +var + MMCIDS: string; +begin + if CDS_HZ.IsEmpty then + Exit; + if not CDS_HZ.Locate('SSel', True, []) then + begin + Application.MessageBox('ûÓÐÑ¡ÔñÊý¾Ý!', 'Ìáʾ', 0); + Exit; + end; + + MMCIDS := ''; + CDS_HZ.DisableControls; + try + CDS_HZ.First; + while not CDS_HZ.Eof do + begin + if CDS_HZ.fieldbyname('SSel').AsBoolean then + begin + if MMCIDS <> '' then + MMCIDS := MMCIDS + ',' + QuotedStr(Trim(CDS_HZ.fieldbyname('MCID').AsString)) + else + MMCIDS := QuotedStr(Trim(CDS_HZ.fieldbyname('MCID').AsString)); + end; + CDS_HZ.Next; + end; + finally + CDS_HZ.EnableControls; + end; + + if MMCIDS = '' then + Exit; + + if Application.MessageBox(PChar('È·¶¨Òª' + ALogAction + 'Âð£¿'), 'Ìáʾ', 32 + 4) <> IDYES then + Exit; + + try + ADOQueryCmd.Connection.BeginTrans; + with ADOQueryCmd do + begin + Close; + SQL.Clear; + SQL.Add('update BS_Machine set ' + AFieldName + '=' + QuotedStr('')); + SQL.Add(' , Editer=''' + Trim(DName) + ''''); + SQL.Add(' , Edittime=getdate()'); + SQL.Add(' where MCID in (' + MMCIDS + ')'); + ExecSQL; + end; + with ADOQueryCmd do + begin + Close; + SQL.Clear; + 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(ALogAction))); + SQL.Add(',' + QuotedStr(Trim(MMCIDS))); + SQL.Add(',' + QuotedStr(Trim('³É¹¦'))); + SQL.Add(')'); + ExecSQL; + end; + ADOQueryCmd.Connection.CommitTrans; + + CDS_HZ.DisableControls; + try + CDS_HZ.First; + while not CDS_HZ.Eof do + begin + if CDS_HZ.fieldbyname('SSel').AsBoolean then + begin + CDS_HZ.Edit; + CDS_HZ.fieldbyname(AFieldName).AsString := ''; + CDS_HZ.Post; + end; + CDS_HZ.Next; + end; + finally + CDS_HZ.EnableControls; + end; + InitGrid(); + Application.MessageBox('½â°ó³É¹¦£¡', 'ÌáʾÐÅÏ¢'); + except + ADOQueryCmd.Connection.RollbackTrans; + Application.MessageBox(PChar(Exception(ExceptObject).Message), 'ÌáʾÐÅÏ¢', 0); + end; +end; + procedure TfrmMachineManage.N1Click(Sender: TObject); begin if CDS_HZ.IsEmpty then @@ -463,6 +577,16 @@ begin SelOKNo(CDS_HZ, False); end; +procedure TfrmMachineManage.N3Click(Sender: TObject); +begin + UnbindProduct('C_CodeName', '½â°ó²úÆ·1'); +end; + +procedure TfrmMachineManage.N4Click(Sender: TObject); +begin + UnbindProduct('C_CodeName2', '½â°ó²úÆ·2'); +end; + procedure TfrmMachineManage.CustomerChange(Sender: TObject); begin ToolButton2.Click; @@ -606,11 +730,15 @@ end; procedure TfrmMachineManage.EditValueT(); var i: Integer; + FldName: string; begin for i := 0 to tv2.ColumnCount - 1 do begin - if uppercase(tv2.Columns[i].DataBinding.FieldName) <> 'SSEL' then - tv2.Columns[i].Options.Editing := True; + FldName := uppercase(tv2.Columns[i].DataBinding.FieldName); + if FldName = 'SSEL' then + Continue; + //Ö»Óлų́ºÅ¡¢»ų́ÀàÐÍÔÊÐí±à¼­£¬²úÆ·±àºÅ/Ãû³ÆÁÐͨ¹ý°ó¶¨°´Å¥Î¬»¤ + tv2.Columns[i].Options.Editing := (FldName = 'MCNO') or (FldName = 'MCTYPE'); end; end; diff --git a/E03梭织å�¯å¸ƒæ£€éªŒ/TatInsp.dpr b/E03梭织å�¯å¸ƒæ£€éªŒ/TatInsp.dpr index e60a7e0..1b03898 100644 --- a/E03梭织å�¯å¸ƒæ£€éªŒ/TatInsp.dpr +++ b/E03梭织å�¯å¸ƒæ£€éªŒ/TatInsp.dpr @@ -31,7 +31,8 @@ uses U_LabelPrint in '..\A00ͨÓô°Ìå\U_LabelPrint.pas' {frmLabelPrint}, U_TatClothInfoSel in '..\A00ͨÓô°Ìå\U_TatClothInfoSel.pas' {frmTatClothInfoSel}, uSZHN_JSON in '..\..\..\public10\ThreeFun\Fun\uSZHN_JSON.pas', - U_SCPersonColor5 in 'U_SCPersonColor5.pas' {frmSCPersonColor5}; + U_SCPersonColor5 in 'U_SCPersonColor5.pas' {frmSCPersonColor5}, + U_TatKnitterQuery in 'U_TatKnitterQuery.pas' {frmTatKnitterQuery}; {$R *.res} diff --git a/E03梭织å�¯å¸ƒæ£€éªŒ/TatInsp.dproj b/E03梭织å�¯å¸ƒæ£€éªŒ/TatInsp.dproj index 7c82f06..0b569b3 100644 --- a/E03梭织å�¯å¸ƒæ£€éªŒ/TatInsp.dproj +++ b/E03梭织å�¯å¸ƒæ£€éªŒ/TatInsp.dproj @@ -140,6 +140,9 @@
frmTatClothInspList
dfm + +
frmTatFlawQuery
+
frmLabelMapSet
dfm @@ -157,6 +160,9 @@
frmSCPersonColor5
dfm
+ +
frmTatKnitterQuery
+
Cfg_2 Base diff --git a/E03梭织å�¯å¸ƒæ£€éªŒ/U_GetDllForm.pas b/E03梭织å�¯å¸ƒæ£€éªŒ/U_GetDllForm.pas index 4ecc247..e5f37dc 100644 --- a/E03梭织å�¯å¸ƒæ£€éªŒ/U_GetDllForm.pas +++ b/E03梭织å�¯å¸ƒæ£€éªŒ/U_GetDllForm.pas @@ -15,7 +15,8 @@ function GetsysParam(muserId: pchar; fparam1: pchar): Boolean; implementation uses - U_DataLink, U_iniParam, U_TatMachInsp, U_TatClothInspList, U_TatFlawQuery; + U_DataLink, U_iniParam, U_TatMachInsp, U_TatClothInspList, U_TatFlawQuery, + U_TatKnitterQuery; ///////////////////////////////////////////////////////////////// // ¹¦ÄÜ˵Ã÷:È¡DllÖеô°Ìå // @@ -151,6 +152,18 @@ begin end; end; + 777: //µ²³µ¹¤²úÁ¿²éѯ + begin + with TfrmTatKnitterQuery.Create(Application.MainForm, Title, trim(Parameters1), trim(Parameters2), trim(Parameters3), trim(Parameters4), trim(Parameters5), trim(Parameters10)) do // + begin + fFormID := FormID; + FormStyle := mstyle; + WindowState := mstate; + BorderStyle := mborderstyle; + mnewHandle := Handle; + end; + end; + 888: //Flaw query begin with TfrmTatFlawQuery.Create(Application.MainForm, Title, trim(Parameters1), trim(Parameters2), trim(Parameters3), trim(Parameters4), trim(Parameters5), trim(Parameters10)) do // diff --git a/E03梭织å�¯å¸ƒæ£€éªŒ/U_SCPersonColor5.pas b/E03梭织å�¯å¸ƒæ£€éªŒ/U_SCPersonColor5.pas index 16aae23..bdd5935 100644 --- a/E03梭织å�¯å¸ƒæ£€éªŒ/U_SCPersonColor5.pas +++ b/E03梭织å�¯å¸ƒæ£€éªŒ/U_SCPersonColor5.pas @@ -140,14 +140,10 @@ begin begin Close; sql.Clear; - sql.Add('select AA.*,row_number () over (order by code) as keyNo from(select DISTINCT C_CODE as code, C_NAME as cname from Bs_CLOTH_INFO '); - //sql.Add('select AA.*,row_number () over (order by name) as keyNo from(select DISTINCT C_NAME as name from Bs_CLOTH_INFO '); + sql.Add('select AA.*,row_number () over (order by cname) as keyNo from(select DISTINCT C_CODE as code, C_NAME as cname from Bs_CLOTH_INFO '); sql.Add(' WHERE ISNULL(Status,0) = 5 '); if C_NAME.Text <> '' then - begin - //SQL.Add(' WHERE C_NAME LIKE ' + QUOTEDSTR('%' + C_NAME.Text + '%')); - SQL.Add(' WHERE C_CODE LIKE ' + QUOTEDSTR('%' + C_NAME.Text + '%')); - end; + SQL.Add(' AND C_NAME LIKE ' + QUOTEDSTR('%' + C_NAME.Text + '%')); SQL.Add(')AA'); // showmessage(sql.text); @@ -170,9 +166,8 @@ begin begin // application.MessageBox(pchar(CDS_Kuang.FieldByName('ZDYName').AsString), 'ÌáʾÐÅÏ¢', 0); TSpeedButton(Controls[i]).Visible := True; - //TSpeedButton(Controls[i]).Caption := Trim(ADOTmp.FieldByName('name').AsString); - TSpeedButton(Controls[i]).Caption := Trim(ADOTmp.FieldByName('CODE').AsString); - TSpeedButton(Controls[i]).Hint := Trim(ADOTmp.FieldByName('cname').AsString); + TSpeedButton(Controls[i]).Caption := Trim(ADOTmp.FieldByName('cname').AsString); + TSpeedButton(Controls[i]).Hint := Trim(ADOTmp.FieldByName('CODE').AsString); end else begin @@ -302,7 +297,7 @@ const LONG_PRESS_MS = 1000; var elapse: Cardinal; - sCap: string; + sCap, sCode: string; begin if not FMouseDown then Exit; @@ -312,6 +307,7 @@ begin begin Timer1.Enabled := False; //Ö»´¥·¢Ò»´Î³¤°´ sCap := Trim(FPressedBtn.Caption); + sCode := Trim(FPressedBtn.Hint); // µ¯´°Ç°ÏȰÑ״̬¸´Î»£¬·Àֹģ̬ÏûÏ¢¿òÖØÈëÂÒ״̬ FMouseDown := False; FPressedBtn := nil; @@ -323,14 +319,13 @@ begin Close; Sql.Clear; //sql.Add('delete bs_cloth_info where C_Name=' + quotedstr(sCap)); - sql.Add('delete bs_cloth_info where C_Code=' + quotedstr(sCap)); + sql.Add('delete bs_cloth_info where C_Code=' + quotedstr(sCode)); 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(trim('±àºÅ£º' + trim(sCap)))); - //sql.Add(',' + quotedstr(trim('Ãû³Æ£º' + trim(sCap)))); + sql.Add(',' + quotedstr(trim('Ãû³Æ£º' + trim(sCap) + '£¬±àºÅ£º' + trim(sCode)))); sql.Add(',' + quotedstr(trim('³É¹¦'))); sql.Add(')'); @@ -356,8 +351,8 @@ end; procedure TfrmSCPersonColor5.btn1Click(Sender: TObject); begin - FName := Trim(TSpeedButton(Sender).Caption); - FName2 := Trim(TSpeedButton(Sender).Hint); + FName := Trim(TSpeedButton(Sender).Hint); + FName2 := Trim(TSpeedButton(Sender).Caption); ModalResult := 1; end; diff --git a/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatClothInspList.dfm b/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatClothInspList.dfm index 0db0ee5..0afa937 100644 --- a/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatClothInspList.dfm +++ b/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatClothInspList.dfm @@ -331,7 +331,7 @@ inherited frmTatClothInspList: TfrmTatClothInspList end object v1Column8: TcxGridDBColumn Caption = #27611#37325 - DataBinding.FieldName = 'GrossWeight' + DataBinding.FieldName = 'GrossWeightWithAdd' DataBinding.IsNullValueType = True HeaderAlignmentHorz = taCenter Options.Editing = False @@ -347,7 +347,7 @@ inherited frmTatClothInspList: TfrmTatClothInspList end object v1Column28: TcxGridDBColumn Caption = #20928#37325 - DataBinding.FieldName = 'NetWeight' + DataBinding.FieldName = 'NetWeightWithAdd' DataBinding.IsNullValueType = True HeaderAlignmentHorz = taCenter Options.Editing = False diff --git a/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatInspEdit.pas b/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatInspEdit.pas index ce11cd1..8bd4766 100644 --- a/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatInspEdit.pas +++ b/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatInspEdit.pas @@ -76,9 +76,11 @@ type private { Private declarations } FGramW: Double; + FAddW: Double; //¼ÓÔØÊ±µÄ¼ÓÖØ¿ìÕÕ£¬±£´æÊ±´Ó½çÃæÃ«¾»ÖØÖÐ¿Û»Ø function SaveData(): Boolean; procedure GetJYXK(FJYIP: string); procedure UpdateCalcMeter(); + function RoundUpToHalf(AValue: Double): Double; //decimal 0.1-0.4 -> 0.5, 0.6-0.9 -> next integer public { Public declarations } end; @@ -114,9 +116,11 @@ begin //gram weight snapshot first, GrossWeight OnChange recalcs CalcMeter with it FGramW := StrToFloatdef(Trim(ADOTmp.fieldbyname('C_GramWeight').AsString), 0); + //¼ÓÖØ¿ìÕÕ£º½çÃæÏÔʾº¬¼ÓÖØµÄë¾»ÖØ£¬±£´æÊ±Ôٿۻأ¬±£Ö¤Êý¾Ý¿â»ù´¡×ֶοھ¶²»±ä + FAddW := StrToFloatdef(Trim(ADOTmp.fieldbyname('add_weight').AsString), 0); - GrossWeight.Text := Trim(ADOTmp.fieldbyname('GrossWeight').AsString); - NetWeight.Text := Trim(ADOTmp.fieldbyname('NetWeight').AsString); + GrossWeight.Text := FormatFloat('0.##', StrToFloatdef(Trim(ADOTmp.fieldbyname('GrossWeight').AsString), 0) + FAddW); + NetWeight.Text := FormatFloat('0.##', StrToFloatdef(Trim(ADOTmp.fieldbyname('NetWeight').AsString), 0) + FAddW); Meter.Text := Trim(ADOTmp.fieldbyname('Meter').AsString); Yardage.Text := Trim(ADOTmp.fieldbyname('Yardage').AsString); UpdateCalcMeter(); @@ -342,8 +346,8 @@ begin sql.Clear; sql.Add(' UPdate Tat_Cloth_Inspect Set '); sql.Add(' PieceNo=''' + Trim(PieceNo.Text) + ''' '); - sql.Add(',GrossWeight=' + FloatToStr(Strtofloatdef(GrossWeight.Text, 0))); - sql.Add(',NetWeight=' + FloatToStr(Strtofloatdef(NetWeight.Text, 0))); + sql.Add(',GrossWeight=' + FloatToStr(Strtofloatdef(GrossWeight.Text, 0) - FAddW)); + sql.Add(',NetWeight=' + FloatToStr(Strtofloatdef(NetWeight.Text, 0) - FAddW)); sql.Add(',Meter=' + FloatToStr(Strtofloatdef(Meter.Text, 0))); sql.Add(',Yardage=' + FloatToStr(Strtofloatdef(Yardage.Text, 0))); sql.Add(',code_table_length=' + FloatToStr(Strtofloatdef(CodeTableLen.Text, 0))); @@ -412,14 +416,30 @@ procedure TfrmTatInspEdit.UpdateCalcMeter(); var MGrossW: Double; begin - //CalcMeter = GrossWeight / C_GramWeight (same as TV3), read-only display + //CalcMeter = (GrossWeightº¬¼ÓÖØ) / C_GramWeight£¬ÏÈÈ¡1λСÊýÔÙ°´0.05/0.5¹æÔò½øÎ»(ÓëTV3µÄCM2Ò»ÖÂ) MGrossW := StrToFloatdef(Trim(GrossWeight.Text), 0); if FGramW > 0 then - CalcMeter.Text := Format('%.1f', [MGrossW / FGramW]) + CalcMeter.Text := FormatFloat('0.#', RoundUpToHalf(RoundFloat(MGrossW / FGramW, 1))) else CalcMeter.Text := ''; end; +function TfrmTatInspEdit.RoundUpToHalf(AValue: Double): Double; +var + MIntPart: Double; +begin + Result := AValue; + if AValue <= 0 then + Exit; + MIntPart := Int(AValue); + if Frac(AValue) < 0.05 then + Result := MIntPart //integer, keep as is + else if Frac(AValue) <= 0.5 then + Result := MIntPart + 0.5 //decimal 0.1-0.4 -> 0.5 + else + Result := MIntPart + 1; //decimal 0.6-0.9 -> next integer +end; + procedure TfrmTatInspEdit.GrossWeightChange(Sender: TObject); begin UpdateCalcMeter(); diff --git a/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatKnitterQuery.dfm b/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatKnitterQuery.dfm new file mode 100644 index 0000000..be9eb27 --- /dev/null +++ b/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatKnitterQuery.dfm @@ -0,0 +1,612 @@ +inherited frmTatKnitterQuery: TfrmTatKnitterQuery + Left = 160 + Top = 87 + Caption = #25377#36710#24037#20135#37327#26597#35810 + ClientHeight = 620 + ClientWidth = 1100 + FormStyle = fsMDIChild + Position = poScreenCenter + Visible = True + ExplicitWidth = 1116 + ExplicitHeight = 659 + PixelsPerInch = 96 + TextHeight = 12 + object ToolBar1: TToolBar [0] + Tag = 1 + Left = 0 + Top = 0 + Width = 1100 + Height = 38 + AutoSize = True + ButtonHeight = 38 + ButtonWidth = 91 + Caption = 'ToolBar1' + Color = clSkyBlue + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [] + Images = DataLink_TatInsp.ImageList_new32 + List = True + ParentColor = False + ParentFont = False + ShowCaptions = True + TabOrder = 0 + object TBRafresh: TToolButton + Left = 0 + Top = 0 + AutoSize = True + Caption = #21047#26032 + ImageIndex = 1 + OnClick = TBRafreshClick + end + object TBExpSum: TToolButton + Left = 71 + Top = 0 + AutoSize = True + Caption = #27719#24635#23548#20986 + ImageIndex = 20 + OnClick = TBExpSumClick + end + object TBExpDet: TToolButton + Left = 166 + Top = 0 + AutoSize = True + Caption = #26126#32454#23548#20986 + ImageIndex = 20 + OnClick = TBExpDetClick + end + object TBSaveFmt: TToolButton + Left = 261 + Top = 0 + AutoSize = True + Caption = #20445#23384#26684#24335 + ImageIndex = 16 + OnClick = TBSaveFmtClick + end + object TBClose: TToolButton + Left = 356 + Top = 0 + AutoSize = True + Caption = #20851#38381 + ImageIndex = 7 + OnClick = TBCloseClick + end + end + object Panel1: TPanel [1] + Left = 0 + Top = 38 + Width = 1100 + Height = 46 + Align = alTop + BevelInner = bvRaised + BevelOuter = bvLowered + Color = 16242829 + ParentBackground = False + TabOrder = 1 + object Label1: TLabel + Left = 523 + Top = 15 + Width = 65 + Height = 12 + Caption = #25377#36710#24037#21517#31216 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + end + object Label2: TLabel + Left = 353 + Top = 15 + Width = 26 + Height = 12 + Caption = #21697#21517 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + end + object Label4: TLabel + Left = 204 + Top = 16 + Width = 13 + Height = 12 + Caption = #33267 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + end + object knitter: TEdit + Tag = 2 + Left = 594 + Top = 10 + Width = 110 + Height = 20 + Hint = '0' + TabOrder = 0 + OnKeyPress = knitterKeyPress + end + object C_Name: TEdit + Tag = 2 + Left = 387 + Top = 12 + Width = 130 + Height = 20 + Hint = '0' + TabOrder = 1 + OnKeyPress = C_NameKeyPress + end + object IsJYTime: TCheckBox + Left = 12 + Top = 15 + Width = 90 + Height = 17 + Caption = #25353#26816#39564#26102#38388 + Checked = True + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + State = cbChecked + TabOrder = 2 + end + object BegDate: TDateTimePicker + Left = 108 + Top = 12 + Width = 90 + Height = 22 + Date = 44774.000000000000000000 + Format = 'yyyy-MM-dd' + Time = 0.464742650459811600 + TabOrder = 3 + end + object EndDate: TDateTimePicker + Left = 223 + Top = 12 + Width = 90 + Height = 22 + Date = 44774.000000000000000000 + Format = 'yyyy-MM-dd' + Time = 0.464742650459811600 + TabOrder = 4 + end + end + object cxPageControl1: TcxPageControl [2] + Left = 0 + Top = 84 + Width = 1100 + Height = 536 + Align = alClient + TabOrder = 2 + Properties.ActivePage = TabDet + Properties.CustomButtons.Buttons = <> + ClientRectBottom = 534 + ClientRectLeft = 2 + ClientRectRight = 1098 + ClientRectTop = 22 + object TabSum: TcxTabSheet + Caption = #27719#24635#39029 + ImageIndex = 0 + object cxGridS: TcxGrid + Left = 0 + Top = 30 + Width = 1096 + Height = 482 + Align = alClient + BorderStyle = cxcbsNone + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [] + ParentFont = False + TabOrder = 0 + object TvS: TcxGridDBTableView + Navigator.Buttons.CustomButtons = <> + ScrollbarAnnotations.CustomAnnotations = <> + DataController.DataSource = DS_S + DataController.Filter.AutoDataSetFilter = True + DataController.Options = [dcoAssignGroupingValues, dcoAssignMasterDetailKeys, dcoSaveExpanding, dcoImmediatePost] + DataController.Summary.DefaultGroupSummaryItems = <> + DataController.Summary.FooterSummaryItems = < + item + Kind = skSum + Column = TvSSumQty + end + item + Kind = skSum + Column = TvSRollCount + end> + DataController.Summary.SummaryGroups = <> + OptionsCustomize.ColumnFiltering = False + OptionsView.Footer = True + OptionsView.GroupByBox = False + OptionsView.IndicatorWidth = 30 + Styles.IncSearch = DataLink_TatInsp.SHuangSe + Styles.Footer = DataLink_TatInsp.Default + Styles.Header = DataLink_TatInsp.Default + Styles.Inactive = DataLink_TatInsp.SHuangSe + Styles.Selection = DataLink_TatInsp.SHuangSe + OnCustomDrawIndicatorCell = TvSCustomDrawIndicatorCell + object TvSknitter: TcxGridDBColumn + Caption = #25377#36710#24037#21517#31216 + DataBinding.FieldName = 'knitter' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 160 + end + object TvSC_Name: TcxGridDBColumn + Caption = #21697#21517 + DataBinding.FieldName = 'C_Name' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 160 + end + object TvSSumQty: TcxGridDBColumn + Caption = #20135#37327 + DataBinding.FieldName = 'SumQty' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 100 + end + object TvSRollCount: TcxGridDBColumn + Caption = #21367#25968 + DataBinding.FieldName = 'RollCount' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 100 + end + end + object cxGridSLevel1: TcxGridLevel + GridView = TvS + end + end + object PanelS: TPanel + Left = 0 + Top = 0 + Width = 1096 + Height = 30 + Align = alTop + TabOrder = 1 + object LabelS1: TLabel + Left = 10 + Top = 8 + Width = 78 + Height = 12 + Caption = #27599#39029#35760#24405#26465#25968 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + end + object LBCPAPS: TLabel + Left = 310 + Top = 8 + Width = 85 + Height = 12 + Caption = #24403#21069#39029'/'#24635#39029#25968 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + end + object TCBNORS: TComboBox + Tag = 2 + Left = 95 + Top = 5 + Width = 78 + Height = 20 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ItemIndex = 0 + ParentFont = False + TabOrder = 0 + Text = '500' + OnChange = TCBNORSChange + Items.Strings = ( + '500' + '1000' + '5000' + '10000') + end + object BTLPS: TButton + Left = 200 + Top = 4 + Width = 60 + Height = 22 + Caption = #19978#19968#39029 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + TabOrder = 1 + OnClick = BTLPSClick + end + object BTNPS: TButton + Left = 400 + Top = 4 + Width = 60 + Height = 22 + Caption = #19979#19968#39029 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + TabOrder = 2 + OnClick = BTNPSClick + end + end + end + object TabDet: TcxTabSheet + Caption = #26126#32454#39029 + ImageIndex = 1 + object cxGridD: TcxGrid + Left = 0 + Top = 30 + Width = 1096 + Height = 482 + Align = alClient + BorderStyle = cxcbsNone + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [] + ParentFont = False + TabOrder = 0 + object TvD: TcxGridDBTableView + Navigator.Buttons.CustomButtons = <> + ScrollbarAnnotations.CustomAnnotations = <> + DataController.DataSource = DS_D + DataController.Filter.AutoDataSetFilter = True + DataController.Options = [dcoAssignGroupingValues, dcoAssignMasterDetailKeys, dcoSaveExpanding, dcoImmediatePost] + DataController.Summary.DefaultGroupSummaryItems = <> + DataController.Summary.FooterSummaryItems = < + item + Kind = skSum + Column = TvDqty + end> + DataController.Summary.SummaryGroups = <> + OptionsCustomize.ColumnFiltering = False + OptionsView.Footer = True + OptionsView.GroupByBox = False + OptionsView.IndicatorWidth = 30 + Styles.IncSearch = DataLink_TatInsp.SHuangSe + Styles.Footer = DataLink_TatInsp.Default + Styles.Header = DataLink_TatInsp.Default + Styles.Inactive = DataLink_TatInsp.SHuangSe + Styles.Selection = DataLink_TatInsp.SHuangSe + OnCustomDrawIndicatorCell = TvDCustomDrawIndicatorCell + object TvDFillTime: TcxGridDBColumn + Caption = #26816#39564#26102#38388 + DataBinding.FieldName = 'FillTime' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 140 + end + object TvDCARNO: TcxGridDBColumn + Caption = #19979#24067#26426#21488#21495 + DataBinding.FieldName = 'CARNO' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 110 + end + object TvDknitter: TcxGridDBColumn + Caption = #25377#36710#24037#21517#31216 + DataBinding.FieldName = 'knitter' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 130 + end + object TvDC_Name: TcxGridDBColumn + Caption = #21697#21517 + DataBinding.FieldName = 'C_Name' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 150 + end + object TvDqty: TcxGridDBColumn + Caption = #20135#37327 + DataBinding.FieldName = 'qty' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 90 + end + object TvDCIID: TcxGridDBColumn + Caption = #21367#26465#30721 + DataBinding.FieldName = 'CIID' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 120 + end + end + object cxGridDLevel1: TcxGridLevel + GridView = TvD + end + end + object PanelD: TPanel + Left = 0 + Top = 0 + Width = 1096 + Height = 30 + Align = alTop + TabOrder = 1 + object LabelD1: TLabel + Left = 10 + Top = 8 + Width = 78 + Height = 12 + Caption = #27599#39029#35760#24405#26465#25968 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + end + object LBCPAPD: TLabel + Left = 310 + Top = 8 + Width = 85 + Height = 12 + Caption = #24403#21069#39029'/'#24635#39029#25968 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + end + object TCBNORD: TComboBox + Tag = 2 + Left = 95 + Top = 5 + Width = 78 + Height = 20 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ItemIndex = 0 + ParentFont = False + TabOrder = 0 + Text = '500' + OnChange = TCBNORDChange + Items.Strings = ( + '500' + '1000' + '5000' + '10000') + end + object BTLPD: TButton + Left = 200 + Top = 4 + Width = 60 + Height = 22 + Caption = #19978#19968#39029 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + TabOrder = 1 + OnClick = BTLPDClick + end + object BNTPD: TButton + Left = 400 + Top = 4 + Width = 60 + Height = 22 + Caption = #19979#19968#39029 + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + TabOrder = 2 + OnClick = BNTPDClick + end + end + end + end + object MovePanel2: TMovePanel [3] + Left = 592 + Top = 216 + Width = 289 + Height = 49 + BevelInner = bvLowered + Caption = #27491#22312#26597#35810#25968#25454#65292#35831#31245#21518#8230#8230 + Color = clSkyBlue + Font.Charset = GB2312_CHARSET + Font.Color = clRed + Font.Height = -14 + Font.Name = #23435#20307 + Font.Style = [fsBold] + ParentFont = False + TabOrder = 3 + Visible = False + end + object ADOQSum: TADOQuery [4] + Connection = DataLink_TatInsp.ADOLink + LockType = ltReadOnly + Parameters = <> + Left = 40 + Top = 296 + end + object ADOQDetail: TADOQuery [5] + Connection = DataLink_TatInsp.ADOLink + LockType = ltReadOnly + Parameters = <> + Left = 120 + Top = 296 + end + object ADOQueryTemp: TADOQuery [6] + Connection = DataLink_TatInsp.ADOLink + LockType = ltReadOnly + Parameters = <> + Left = 280 + Top = 296 + end + object DS_S: TDataSource [7] + DataSet = CDS_Sum + Left = 680 + Top = 324 + end + object DS_D: TDataSource [8] + DataSet = CDS_Detail + Left = 720 + Top = 324 + end + object CDS_Sum: TClientDataSet [9] + Aggregates = <> + Params = <> + Left = 616 + Top = 360 + end + object CDS_Detail: TClientDataSet [10] + Aggregates = <> + Params = <> + Left = 656 + Top = 360 + end + inherited ADOQueryBaseCmd: TADOQuery + Connection = DataLink_TatInsp.ADOLink + end + inherited ADOQueryBaseTemp: TADOQuery + Connection = DataLink_TatInsp.ADOLink + end +end diff --git a/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatKnitterQuery.pas b/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatKnitterQuery.pas new file mode 100644 index 0000000..4ac8eb4 --- /dev/null +++ b/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatKnitterQuery.pas @@ -0,0 +1,365 @@ +unit U_TatKnitterQuery; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData, + cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB, + cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView, + cxGridTableView, cxGridDBTableView, cxGrid, DBClient, cxCheckBox, cxCalendar, + cxPC, Math, U_BaseList, MovePanel, cxLookAndFeels, cxLookAndFeelPainters, + cxNavigator, dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters, + dxDateRanges, System.StrUtils, dxScrollbarAnnotations, dxSkinWXI; + +type + TfrmTatKnitterQuery = class(TfrmBaseList) + ToolBar1: TToolBar; + TBRafresh: TToolButton; + TBExpSum: TToolButton; + TBExpDet: TToolButton; + TBSaveFmt: TToolButton; + TBClose: TToolButton; + Panel1: TPanel; + Label1: TLabel; + knitter: TEdit; + Label2: TLabel; + C_Name: TEdit; + IsJYTime: TCheckBox; + BegDate: TDateTimePicker; + Label4: TLabel; + EndDate: TDateTimePicker; + cxPageControl1: TcxPageControl; + TabSum: TcxTabSheet; + cxGridS: TcxGrid; + TvS: TcxGridDBTableView; + TvSknitter: TcxGridDBColumn; + TvSC_Name: TcxGridDBColumn; + TvSSumQty: TcxGridDBColumn; + TvSRollCount: TcxGridDBColumn; + cxGridSLevel1: TcxGridLevel; + PanelS: TPanel; + LabelS1: TLabel; + TCBNORS: TComboBox; + BTLPS: TButton; + LBCPAPS: TLabel; + BTNPS: TButton; + TabDet: TcxTabSheet; + cxGridD: TcxGrid; + TvD: TcxGridDBTableView; + TvDCARNO: TcxGridDBColumn; + TvDknitter: TcxGridDBColumn; + TvDC_Name: TcxGridDBColumn; + TvDqty: TcxGridDBColumn; + TvDCIID: TcxGridDBColumn; + cxGridDLevel1: TcxGridLevel; + PanelD: TPanel; + LabelD1: TLabel; + TCBNORD: TComboBox; + BTLPD: TButton; + LBCPAPD: TLabel; + BNTPD: TButton; + MovePanel2: TMovePanel; + ADOQSum: TADOQuery; + ADOQDetail: TADOQuery; + ADOQueryTemp: TADOQuery; + DS_S: TDataSource; + DS_D: TDataSource; + CDS_Sum: TClientDataSet; + CDS_Detail: TClientDataSet; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure FormCreate(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure TBRafreshClick(Sender: TObject); + procedure TBExpSumClick(Sender: TObject); + procedure TBExpDetClick(Sender: TObject); + procedure TBSaveFmtClick(Sender: TObject); + procedure TBCloseClick(Sender: TObject); + procedure knitterKeyPress(Sender: TObject; var Key: Char); + procedure C_NameKeyPress(Sender: TObject; var Key: Char); + procedure BTLPSClick(Sender: TObject); + procedure BTNPSClick(Sender: TObject); + procedure TCBNORSChange(Sender: TObject); + procedure BTLPDClick(Sender: TObject); + procedure BNTPDClick(Sender: TObject); + procedure TCBNORDChange(Sender: TObject); + procedure TvSCustomDrawIndicatorCell(Sender: TcxGridTableView; + ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; + var ADone: Boolean); + procedure TvDCustomDrawIndicatorCell(Sender: TcxGridTableView; + ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; + var ADone: Boolean); + private + FWorkshop: string; + CurrentPageS, RecordsNumberS, CurrentPageD, RecordsNumberD: Integer; + function BuildCriteria(): string; + procedure InitSum(); + procedure InitDetail(); + { Private declarations } + public + { Public declarations } + end; + +var + frmTatKnitterQuery: TfrmTatKnitterQuery; + +implementation + +uses + U_DataLink, U_RTFun; + +{$R *.dfm} + +procedure TfrmTatKnitterQuery.FormClose(Sender: TObject; var Action: TCloseAction); +begin + inherited; + Action := caFree; +end; + +procedure TfrmTatKnitterQuery.FormCreate(Sender: TObject); +begin + inherited; + FWorkshop := Trim(Self.fParameters3); +end; + +procedure TfrmTatKnitterQuery.FormShow(Sender: TObject); +begin + inherited; + CurrentPageS := 1; + RecordsNumberS := 500; + CurrentPageD := 1; + RecordsNumberD := 500; + ReadCxGrid(Trim(Self.Caption) + 'TvS', TvS, 'óÒ×¼ìÑé¹ÜÀí'); + ReadCxGrid(Trim(Self.Caption) + 'TvD', TvD, 'óÒ×¼ìÑé¹ÜÀí'); + EndDate.DateTime := SGetServerDate(ADOQueryTemp); + BegDate.DateTime := EndDate.DateTime; + InitSum(); + InitDetail(); +end; + +function TfrmTatKnitterQuery.BuildCriteria(): string; +var + WSql: string; +begin + WSql := SGetFilters(Panel1, 1, 2); + if Trim(WSql) <> '' then + WSql := ' and ' + Trim(WSql); + + if Trim(FWorkshop) <> '' then + WSql := WSql + ' and A.Workshop=' + QuotedStr(Trim(FWorkshop)); + + if IsJYTime.Checked then + begin + WSql := WSql + ' and A.FillTime>' + QuotedStr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)); + WSql := WSql + ' and A.FillTime<=' + QuotedStr(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1)); + end + else if Trim(WSql) = '' then + WSql := ' and 1=2 '; + + Result := WSql; +end; + +procedure TfrmTatKnitterQuery.InitSum(); +var + WSql: string; +begin + MovePanel2.Left := (Self.Width - MovePanel2.Width) div 2; + MovePanel2.Visible := True; + MovePanel2.Refresh; + WSql := BuildCriteria(); + if Trim(WSql) = 'and 1=2' then + Application.MessageBox('¹´Ñ¡¼ìÑéʱ¼ä»òÌîÈëËÑË÷Ìõ¼þ', 'Ìáʾ', 0); + + try + CDS_Sum.DisableControls; + with ADOQSum do + begin + Close; + SQL.Clear; + SQL.Add('exec P_Tat_Knitter_Sum_Get_Page '); + SQL.Add('@pageIndex=' + IntToStr(CurrentPageS)); + SQL.Add(',@pageSize=' + IntToStr(RecordsNumberS)); + SQL.Add(',@criteria=' + QuotedStr(WSql)); + Open; + end; + SCreateCDS(ADOQSum, CDS_Sum); + SInitCDSData(ADOQSum, CDS_Sum); + LBCPAPS.Caption := IntToStr(CurrentPageS) + '/' + IntToStr(Ceil(ADOQSum.FieldByName('TotalCount').AsInteger / RecordsNumberS)); + finally + CDS_Sum.EnableControls; + MovePanel2.Visible := False; + end; +end; + +procedure TfrmTatKnitterQuery.InitDetail(); +var + WSql: string; +begin + MovePanel2.Left := (Self.Width - MovePanel2.Width) div 2; + MovePanel2.Visible := True; + MovePanel2.Refresh; + WSql := BuildCriteria(); + if Trim(WSql) = 'and 1=2' then + Application.MessageBox('¹´Ñ¡¼ìÑéʱ¼ä»òÌîÈëËÑË÷Ìõ¼þ', 'Ìáʾ', 0); + + try + CDS_Detail.DisableControls; + with ADOQDetail do + begin + Close; + SQL.Clear; + SQL.Add('exec P_Tat_Knitter_Get_Page '); + SQL.Add('@pageIndex=' + IntToStr(CurrentPageD)); + SQL.Add(',@pageSize=' + IntToStr(RecordsNumberD)); + SQL.Add(',@criteria=' + QuotedStr(WSql)); + Open; + end; + SCreateCDS(ADOQDetail, CDS_Detail); + SInitCDSData(ADOQDetail, CDS_Detail); + LBCPAPD.Caption := IntToStr(CurrentPageD) + '/' + IntToStr(Ceil(ADOQDetail.FieldByName('TotalCount').AsInteger / RecordsNumberD)); + finally + CDS_Detail.EnableControls; + MovePanel2.Visible := False; + end; +end; + +procedure TfrmTatKnitterQuery.TBRafreshClick(Sender: TObject); +begin + CurrentPageS := 1; + CurrentPageD := 1; + InitSum(); + InitDetail(); +end; + +procedure TfrmTatKnitterQuery.TBExpSumClick(Sender: TObject); +begin + if CDS_Sum.IsEmpty then + Exit; + TcxGridToExcel(Trim(Self.Caption) + '-»ã×Ü', cxGridS); +end; + +procedure TfrmTatKnitterQuery.TBExpDetClick(Sender: TObject); +begin + if CDS_Detail.IsEmpty then + Exit; + TcxGridToExcel(Trim(Self.Caption) + '-Ã÷ϸ', cxGridD); +end; + +procedure TfrmTatKnitterQuery.TBSaveFmtClick(Sender: TObject); +begin + WriteCxGrid(Trim(Self.Caption) + 'TvS', TvS, 'óÒ×¼ìÑé¹ÜÀí'); + WriteCxGrid(Trim(Self.Caption) + 'TvD', TvD, 'óÒ×¼ìÑé¹ÜÀí'); +end; + +procedure TfrmTatKnitterQuery.TBCloseClick(Sender: TObject); +begin + Close; +end; + +procedure TfrmTatKnitterQuery.knitterKeyPress(Sender: TObject; var Key: Char); +begin + if Key = #13 then + begin + CurrentPageS := 1; + CurrentPageD := 1; + InitSum(); + InitDetail(); + end; +end; + +procedure TfrmTatKnitterQuery.C_NameKeyPress(Sender: TObject; var Key: Char); +begin + if Key = #13 then + begin + CurrentPageS := 1; + CurrentPageD := 1; + InitSum(); + InitDetail(); + end; +end; + +procedure TfrmTatKnitterQuery.BTLPSClick(Sender: TObject); +begin + if CurrentPageS > 1 then + CurrentPageS := CurrentPageS - 1; + InitSum(); +end; + +procedure TfrmTatKnitterQuery.BTNPSClick(Sender: TObject); +begin + if CurrentPageS < ADOQSum.FieldByName('TotalCount').AsInteger / RecordsNumberS then + CurrentPageS := CurrentPageS + 1; + InitSum(); +end; + +procedure TfrmTatKnitterQuery.TCBNORSChange(Sender: TObject); +begin + RecordsNumberS := StrToInt(TCBNORS.Text); + CurrentPageS := 1; + InitSum(); +end; + +procedure TfrmTatKnitterQuery.BTLPDClick(Sender: TObject); +begin + if CurrentPageD > 1 then + CurrentPageD := CurrentPageD - 1; + InitDetail(); +end; + +procedure TfrmTatKnitterQuery.BNTPDClick(Sender: TObject); +begin + if CurrentPageD < ADOQDetail.FieldByName('TotalCount').AsInteger / RecordsNumberD then + CurrentPageD := CurrentPageD + 1; + InitDetail(); +end; + +procedure TfrmTatKnitterQuery.TCBNORDChange(Sender: TObject); +begin + RecordsNumberD := StrToInt(TCBNORD.Text); + CurrentPageD := 1; + InitDetail(); +end; + +procedure TfrmTatKnitterQuery.TvSCustomDrawIndicatorCell(Sender: TcxGridTableView; + ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; + var ADone: Boolean); +var + FValue: string; + FBounds: TRect; +begin + FBounds := AViewInfo.Bounds; + if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then + begin + ACanvas.FillRect(FBounds); + ACanvas.DrawComplexFrame(FBounds, clBlack, clBlack, [bBottom, bLeft, bRight], 1); + FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1); + InflateRect(FBounds, -3, -2); + ACanvas.Font.Color := clBlack; + ACanvas.Brush.Style := bsClear; + ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop); + ADone := True; + end; +end; + +procedure TfrmTatKnitterQuery.TvDCustomDrawIndicatorCell(Sender: TcxGridTableView; + ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; + var ADone: Boolean); +var + FValue: string; + FBounds: TRect; +begin + FBounds := AViewInfo.Bounds; + if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then + begin + ACanvas.FillRect(FBounds); + ACanvas.DrawComplexFrame(FBounds, clBlack, clBlack, [bBottom, bLeft, bRight], 1); + FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1); + InflateRect(FBounds, -3, -2); + ACanvas.Font.Color := clBlack; + ACanvas.Brush.Style := bsClear; + ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop); + ADone := True; + end; +end; + +end. diff --git a/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatMachInsp.dfm b/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatMachInsp.dfm index 9cb2078..7385864 100644 --- a/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatMachInsp.dfm +++ b/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatMachInsp.dfm @@ -937,13 +937,13 @@ object Label25: TLabel Left = 7 Top = 17 - Width = 82 - Height = 65 + Width = 52 + Height = 48 AutoSize = False Caption = #20135#21697#32534#21495':' Font.Charset = ANSI_CHARSET Font.Color = clBlack - Font.Height = -27 + Font.Height = -19 Font.Name = 'Arial' Font.Style = [fsBold] ParentFont = False @@ -1072,6 +1072,21 @@ Font.Style = [fsBold] ParentFont = False end + object Label61: TLabel + Left = 8 + Top = 71 + Width = 52 + Height = 48 + AutoSize = False + Caption = #20135#21697#21517#31216':' + Font.Charset = ANSI_CHARSET + Font.Color = clBlack + Font.Height = -19 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + WordWrap = True + end object PCId: TEdit Left = 480 Top = 83 @@ -1118,20 +1133,19 @@ Visible = False end object CodeName: TEdit - Left = 32 - Top = 4 - Width = 32 - Height = 68 + Left = 88 + Top = 66 + Width = 240 + Height = 50 Font.Charset = ANSI_CHARSET Font.Color = clBlack - Font.Height = -53 + Font.Height = -37 Font.Name = 'Arial' Font.Style = [] ParentFont = False - ReadOnly = True TabOrder = 3 - Visible = False OnClick = CIFBegClick + OnExit = CodeNameExit end object edtScan: TEdit Left = 291 @@ -1196,13 +1210,13 @@ OnClick = Button5Click end object code: TEdit - Left = 86 - Top = 14 - Width = 242 - Height = 68 + Left = 88 + Top = 10 + Width = 240 + Height = 50 Font.Charset = ANSI_CHARSET Font.Color = clBlack - Font.Height = -53 + Font.Height = -37 Font.Name = 'Arial' Font.Style = [] ParentFont = False @@ -2664,7 +2678,7 @@ end object v3Column5: TcxGridDBColumn Caption = #20928#37325 - DataBinding.FieldName = 'NetWeight' + DataBinding.FieldName = 'NetWeightWithAdd' DataBinding.IsNullValueType = True HeaderAlignmentHorz = taCenter Options.Editing = False @@ -2673,7 +2687,7 @@ end object v3Column4: TcxGridDBColumn Caption = #37325#37327 - DataBinding.FieldName = 'GrossWeight' + DataBinding.FieldName = 'GrossWeightWithAdd' DataBinding.IsNullValueType = True HeaderAlignmentHorz = taCenter Options.Editing = False @@ -2713,6 +2727,14 @@ Options.Editing = False Width = 80 end + object Tv3c_name: TcxGridDBColumn + Caption = #20135#21697#21517#31216 + DataBinding.FieldName = 'c_name' + DataBinding.IsNullValueType = True + HeaderAlignmentHorz = taCenter + Options.Editing = False + Width = 80 + end object Tv3CalcMeter: TcxGridDBColumn Caption = #35745#31639#31859#25968 DataBinding.FieldName = 'CalcMeter' @@ -2903,6 +2925,10 @@ object 查看: TcxTabSheet Caption = #26597#30475 ImageIndex = 1 + ExplicitLeft = 0 + ExplicitTop = 0 + ExplicitWidth = 0 + ExplicitHeight = 0 object cxGrid1: TcxGrid Left = 0 Top = 0 @@ -3579,6 +3605,7 @@ Font.Style = [fsBold] ParentFont = False TabOrder = 13 + OnChange = add_weightChange OnClick = CIFBegClick OnKeyPress = MJstr3KeyPress end diff --git a/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatMachInsp.pas b/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatMachInsp.pas index 96e7b1c..fae8bf3 100644 --- a/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatMachInsp.pas +++ b/E03梭织å�¯å¸ƒæ£€éªŒ/U_TatMachInsp.pas @@ -349,6 +349,8 @@ type BtnCon: TButton; add_weight: TEdit; Label60: TLabel; + Label61: TLabel; + Tv3c_name: TcxGridDBColumn; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); @@ -411,9 +413,11 @@ type procedure Button10Click(Sender: TObject); procedure codeClick(Sender: TObject); procedure codeExit(Sender: TObject); + procedure CodeNameExit(Sender: TObject); procedure weaver_nameClick(Sender: TObject); procedure InputWeightChange(Sender: TObject); procedure KZChange(Sender: TObject); + procedure add_weightChange(Sender: TObject); procedure edtMaxClick(Sender: TObject); procedure BtnConClick(Sender: TObject); private @@ -482,7 +486,7 @@ end; procedure TfrmTatMachInsp.CalcInputLenByWeightKZ; var - W, KZValue: Double; + W, AW, KZValue: Double; begin if Trim(InputWeight.Text) = '' then Exit; @@ -491,6 +495,8 @@ begin if not TryStrToFloat(Trim(InputWeight.Text), W) then Exit; + if not TryStrToFloat(Trim(add_weight.Text), AW) then + AW := 0; if not TryStrToFloat(Trim(KZ.Text), KZValue) then Exit; @@ -500,7 +506,7 @@ begin Exit; end; - InputLen.Text := FormatFloat('0.##', W / KZValue); + InputLen.Text := FormatFloat('0.##', (W + AW) / KZValue); end; procedure TfrmTatMachInsp.SetINIFile(); @@ -1058,6 +1064,11 @@ begin CalcInputLenByWeightKZ; end; +procedure TfrmTatMachInsp.add_weightChange(Sender: TObject); +begin + CalcInputLenByWeightKZ; +end; + procedure TfrmTatMachInsp.InitJTM(MCIID: string); begin with ADOTmp do @@ -1165,7 +1176,7 @@ begin Open; end; - if not ADOTmp.IsEmpty then + if (not ADOTmp.IsEmpty) and (ADOTmp.FieldByName('Status').AsInteger = 5) then begin code.Text := Trim(ADOTmp.FieldByName('C_Code').AsString); CodeName.Text := Trim(ADOTmp.FieldByName('C_Name').AsString); @@ -1181,7 +1192,10 @@ begin end else begin - Application.MessageBox('δÕÒµ½¸Ã²úÆ·±àºÅ£¬ÇëÖØÐÂÊäÈ룡', 'Ìáʾ', MB_ICONWARNING); + if ADOTmp.IsEmpty then + Application.MessageBox('δÕÒµ½¸Ã²úÆ·±àºÅ£¬ÇëÖØÐÂÊäÈ룡', 'Ìáʾ', MB_ICONWARNING) + else + Application.MessageBox('¸Ã²úÆ·ÒÑÍ£Ó㬲»ÄÜʹÓã¡', 'Ìáʾ', MB_ICONWARNING); CodeName.Text := ''; MF.Text := ''; KZ.Text := ''; @@ -1191,6 +1205,50 @@ begin end; end; +procedure TfrmTatMachInsp.CodeNameExit(Sender: TObject); +begin + if Trim(CodeName.Text) = '' then + Exit; + + CodeName.Text := Trim(CodeName.Text); + + with ADOTmp do + begin + Close; + SQL.Clear; + SQL.Add('SELECT * FROM Bs_Cloth_Info WHERE C_Name = ' + QuotedStr(CodeName.Text)); + Open; + end; + + if (not ADOTmp.IsEmpty) and (ADOTmp.FieldByName('Status').AsInteger = 5) then + begin + code.Text := Trim(ADOTmp.FieldByName('C_Code').AsString); + CodeName.Text := Trim(ADOTmp.FieldByName('C_Name').AsString); + MF.Text := Trim(ADOTmp.FieldByName('C_Width').AsString); + KZ.Text := Trim(ADOTmp.FieldByName('C_GramWeight').AsString); + SPEC.Text := Trim(ADOTmp.FieldByName('C_SPEC').AsString); + C_LongitudeBatchNo.Text := Trim(ADOTmp.FieldByName('C_LongitudeBatchNo').AsString); + C_LatitudeBatchNo.Text := Trim(ADOTmp.FieldByName('C_LatitudeBatchNo').AsString); + + FMainId := ''; + FSubId := ''; + Label14.Caption := '¶©µ¥ºÅ'; + end + else + begin + if ADOTmp.IsEmpty then + Application.MessageBox('δÕÒµ½¸Ã²úÆ·Ãû³Æ£¬ÇëÖØÐÂÊäÈ룡', 'Ìáʾ', MB_ICONWARNING) + else + Application.MessageBox('¸Ã²úÆ·ÒÑÍ£Ó㬲»ÄÜʹÓã¡', 'Ìáʾ', MB_ICONWARNING); + code.Text := ''; + MF.Text := ''; + KZ.Text := ''; + SPEC.Text := ''; + C_LongitudeBatchNo.Text := ''; + C_LatitudeBatchNo.Text := ''; + end; +end; + procedure TfrmTatMachInsp.ComboBox1Change(Sender: TObject); begin SetINIFile(); @@ -1437,12 +1495,14 @@ begin sql.Add(' ISNULL((select top 1 TRY_CAST(B.estimated_diff AS decimal(18,4)) from Bs_Cloth_Info B where B.c_code = A.c_code), 0) AS EstimatedDiff,'); sql.Add(' ROUND(ABS(CM2.CalcMeter - ISNULL(TRY_CAST(A.code_table_length AS decimal(18,4)), 0)), 1) AS ActualDiff'); sql.Add(' ,ROUND(ISNULL(TRY_CAST(A.Meter AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_length AS decimal(18,4)), 0), 2) AS MeterWithAddLength'); + sql.Add(' ,ROUND(ISNULL(TRY_CAST(A.GrossWeight AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_weight AS decimal(18,4)), 0), 2) AS GrossWeightWithAdd'); + sql.Add(' ,ROUND(ISNULL(TRY_CAST(A.NetWeight AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_weight AS decimal(18,4)), 0), 2) AS NetWeightWithAdd'); sql.Add('from Tat_Cloth_Inspect A '); - sql.Add('outer apply (select ROUND(ISNULL(TRY_CAST(A.GrossWeight AS decimal(18,4)) / NULLIF(TRY_CAST(A.C_GramWeight AS decimal(18,4)), 0), 0), 1) as CalcMeterRaw) CM'); - sql.Add('outer apply (select CASE WHEN CM.CalcMeterRaw <= 0 THEN CM.CalcMeterRaw'); - sql.Add(' WHEN CM.CalcMeterRaw - FLOOR(CM.CalcMeterRaw) < 0.05 THEN FLOOR(CM.CalcMeterRaw)'); - sql.Add(' WHEN CM.CalcMeterRaw - FLOOR(CM.CalcMeterRaw) <= 0.5 THEN FLOOR(CM.CalcMeterRaw) + 0.5'); - sql.Add(' ELSE CEILING(CM.CalcMeterRaw) END as CalcMeter) CM2'); + sql.Add('outer apply (select ROUND(ISNULL((ISNULL(TRY_CAST(A.GrossWeight AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_weight AS decimal(18,4)), 0)) / NULLIF(TRY_CAST(A.C_GramWeight AS decimal(18,4)), 0), 0), 1) as CalcMeterRaw) CM'); + sql.Add('outer apply (select CASE WHEN CAST(CM.CalcMeterRaw AS decimal(18,1)) <= 0 THEN CAST(CM.CalcMeterRaw AS decimal(18,1))'); + sql.Add(' WHEN CAST(CM.CalcMeterRaw AS decimal(18,1)) - FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1))) < 0.05 THEN FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1)))'); + sql.Add(' WHEN CAST(CM.CalcMeterRaw AS decimal(18,1)) - FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1))) <= 0.5 THEN FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1))) + 0.5'); + sql.Add(' ELSE CEILING(CAST(CM.CalcMeterRaw AS decimal(18,1))) END as CalcMeter) CM2'); sql.Add('where mainid=' + quotedstr(fmainid)); sql.Add('and filler=' + quotedstr(dname)); sql.Add('order by filltime desc'); @@ -1454,18 +1514,21 @@ begin sql.Add(' ISNULL((select top 1 TRY_CAST(B.estimated_diff AS decimal(18,4)) from Bs_Cloth_Info B where B.c_code = A.c_code), 0) AS EstimatedDiff,'); sql.Add(' ROUND(ABS(CM2.CalcMeter - ISNULL(TRY_CAST(A.code_table_length AS decimal(18,4)), 0)), 1) AS ActualDiff'); sql.Add(' ,ROUND(ISNULL(TRY_CAST(A.Meter AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_length AS decimal(18,4)), 0), 2) AS MeterWithAddLength'); + sql.Add(' ,ROUND(ISNULL(TRY_CAST(A.GrossWeight AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_weight AS decimal(18,4)), 0), 2) AS GrossWeightWithAdd'); + sql.Add(' ,ROUND(ISNULL(TRY_CAST(A.NetWeight AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_weight AS decimal(18,4)), 0), 2) AS NetWeightWithAdd'); sql.Add('from Tat_Cloth_Inspect A '); - sql.Add('outer apply (select ROUND(ISNULL(TRY_CAST(A.GrossWeight AS decimal(18,4)) / NULLIF(TRY_CAST(A.C_GramWeight AS decimal(18,4)), 0), 0), 1) as CalcMeterRaw) CM'); - sql.Add('outer apply (select CASE WHEN CM.CalcMeterRaw <= 0 THEN CM.CalcMeterRaw'); - sql.Add(' WHEN CM.CalcMeterRaw - FLOOR(CM.CalcMeterRaw) < 0.05 THEN FLOOR(CM.CalcMeterRaw)'); - sql.Add(' WHEN CM.CalcMeterRaw - FLOOR(CM.CalcMeterRaw) <= 0.5 THEN FLOOR(CM.CalcMeterRaw) + 0.5'); - sql.Add(' ELSE CEILING(CM.CalcMeterRaw) END as CalcMeter) CM2'); + sql.Add('outer apply (select ROUND(ISNULL((ISNULL(TRY_CAST(A.GrossWeight AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_weight AS decimal(18,4)), 0)) / NULLIF(TRY_CAST(A.C_GramWeight AS decimal(18,4)), 0), 0), 1) as CalcMeterRaw) CM'); + sql.Add('outer apply (select CASE WHEN CAST(CM.CalcMeterRaw AS decimal(18,1)) <= 0 THEN CAST(CM.CalcMeterRaw AS decimal(18,1))'); + sql.Add(' WHEN CAST(CM.CalcMeterRaw AS decimal(18,1)) - FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1))) < 0.05 THEN FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1)))'); + sql.Add(' WHEN CAST(CM.CalcMeterRaw AS decimal(18,1)) - FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1))) <= 0.5 THEN FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1))) + 0.5'); + sql.Add(' ELSE CEILING(CAST(CM.CalcMeterRaw AS decimal(18,1))) END as CalcMeter) CM2'); sql.Add('where convert(varchar(10),filltime,120)=convert(varchar(10),getdate(),120)'); sql.Add('and filler=' + quotedstr(dname)); sql.Add('and mainid=''ÎÞ¶©µ¥'''); sql.Add('order by filltime desc'); end; +// showmessage(sql.text); Open; end; SCreateCDS(ADOQueryMain, CDS_3);