⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bas_item_d0.pas

📁 一个MRPII系统源代码版本
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  begin
    Add_WhCode:='whCode,';
    Add_Str_WhCode:=''''+Extedt_WhCode.text+''',';
    modify_Str_WhCode:='whCode='''+Extedt_WhCode.text+''',';
  end;

    //控制采购员代码,当其为空时不能增加,修改
  if Trim(edt_DeptCode.Text)='' then
  begin
    Add_DeptCode:='';
    Add_Str_DeptCode:='';
    modify_Str_DeptCode:='DeptCode=null,';
  end
  else
  begin
    Add_DeptCode:='DeptCode,';
    Add_Str_DeptCode:=''''+edt_DeptCode.text+''',';
    modify_Str_DeptCode:='DeptCode='''+edt_DeptCode.text+''',';
  end;


  if Trim(Extedt_AssetKmCode.Text)='' then
  begin
  sAssetKmCode:=' AssetKmCode= null';
  sAssetKmCode1:=' null '
  end
  else
  begin
    sAssetKmCode:=' AssetKmCode='+Quotedstr(Trim(Extedt_AssetKmCode.Text));
    sAssetKmCode1:=Quotedstr(Trim(Extedt_AssetKmCode.Text));
  end;


  if (Add) then
  begin
    with AdoQry_Tmp do
    begin
      Close;
      SQL.clear;
      if edt_ClassCode.Text<>'' then
      sql.text:='Insert Item(ItemCode,'+
                          'ItemName,'+
                          'Material,'+
//                        'ItemshortName,'+
                        'UomCode,'+
                        Add_EmployeeCode+
                        Add_WhCode+
                        Add_Pla_EmployeeCode+
                        Add_Wh_EmployeeCode+
                        'ItemType,'+
                        'designno,'+
                        'ItemUsable,'+
                        'maxqty,'+
                        'minqty,'+
                        'limitout,'+
                        'purchldtime,'+
                        'PrepareLT,'+
                        'RunLT,'+
                        'QcLT,'+
                        'mnldtime,'+
                        'PmCode,'+
                        'PmBatch,'+
                        'BarCode,'+
                        'ItemCode2,'+
                        'canSale,'+
                        'Batchstrat,'+
                        'BatchCtrl,'+
                        'LongPurchLT,'+
                        'IScheck, '+
                        'Capacityhours,'+
                        Add_DeptCode+
                        'onlydefaultwh,'+
                        'Itemcreatetime,'+
                        'Itemmodifytime,'+
                        'remArk,'+
                        'ScrApType,'+
                        sql_Itemdisabletime+
                        'AssetKmCode,'+
                        'ItemClass1,'+
                        'ItemClass2,'+
                        'ItemClass3,'+
                        'ItemClass4,'+
                        'ItemClass5,'+
                        'ClassCode,'+
                        'ProductClass,'+
                        'InspecTEmployeeCode,'+
                        'QcClass,'+
                        'ISStockItem ) '+
            'Values ('''+Edt_ItemCode.text+''','+
                     ''''+edt_ItemName.text+''','+
                     quotedstr(Trim(edt_mat.text))+','+
//                     ''''+edt_ItemshortName.text+''','+
                     ''''+Extedt_UomCode.text+''','+
                     Add_Str_EmployeeCode+
                     Add_Str_WhCode+
                     Add_Str_Pla_EmployeeCode+
                     Add_Str_Wh_EmployeeCode+
                     inttostr(cmbbx_ItemType.Itemindex)+','+
                     ''''+edt_Designno.text+''','+
                     inttostr(cmbbx_ItemUsable.Itemindex)+','+
                     edt_maxqty.text+','+
                     edt_minqty.text+','+
                     inttostr(cmbbx_limitout.Itemindex)+','+
                     edt_Purchldtime.text+','+
                     edt_PrepareLT.text+','+
                     edt_RunLT.text+','+
                     edt_QcLT.text+','+
                     edt_Mnldtime.text+','+
                     inttostr(cmbbx_PmCode.Itemindex)+','+
                     edt_PmBatch.text+','+
                     ''''+Extedt_BarCode.text+''','+
                     ''''+Extedt_ItemCode2.text+''','+
                     inttostr(cmbbx_CanSale.Itemindex)+','+
                     inttostr(cmbbx_Batchstrat.Itemindex)+','+
                     inttostr(cmbbx_BatchCtrl.Itemindex)+','+
                     inttostr(cmbbx_LongPurchLT.Itemindex)+','+
                     inttostr(cmbbx_IScheck.Itemindex)+','+
                     edt_Capacityhours.text+','+
                     Add_Str_DeptCode+
                     inttostr(cmbbx_onlydefaultwh.Itemindex)+','+
                     ''''+formatdatetime('yyyy.mm.dd hh:mm:ss',now)+''','+
                     ''''+formatdatetime('yyyy.mm.dd hh:mm:ss',now)+''','+
                     ''''+edt_remArk.text+''','+
                     ''''+inttostr(Cmbbx_ScrApType.ItemIndex+1)+''','+
                     str_Itemdisabletime+
                     sAssetKmCode1+','+
                     ''''+edt_ItemClass1.text+''','+
                     ''''+edt_ItemClass2.text+''','+
                     ''''+edt_ItemClass3.text+''','+
                     ''''+edt_ItemClass4.text+''','+
                     ''''+edt_ItemClass5.text+''','+
                     ''''+edt_ClassCode.text+''','+
                     ''''+edt_ProductClass.text+''','+
                     ' Case When LTrim(RTrim('''+Trim(LEdt_InspecTEmployeeCode.Text)+'''))='''' Then Null '+
                     ' Else '''+Trim(LEdt_InspecTEmployeeCode.Text)+''' end ,'+
                     ''''+edt_QcClass.text+''','+
                     inttostr(Cmbbx_ISStockItem.ItemIndex)+')'
                else
      sql.text:='Insert Item(ItemCode,'+
                          'ItemName,'+
                          'Material,'+
//                        'ItemshortName,'+
                        'UomCode,'+
                        Add_EmployeeCode+
                        Add_WhCode+
                        Add_Pla_EmployeeCode+
                        Add_Wh_EmployeeCode+
                        'ItemType,'+
                        'designno,'+
                        'ItemUsable,'+
                        'maxqty,'+
                        'minqty,'+
                        'limitout,'+
                        'purchldtime,'+
                        'PrepareLT,'+
                        'RunLT,'+
                        'QcLT,'+
                        'mnldtime,'+
                        'PmCode,'+
                        'PmBatch,'+
                        'BarCode,'+
                        'ItemCode2,'+
                        'canSale,'+
                        'Batchstrat,'+
                        'BatchCtrl,'+
                        'LongPurchLT,'+
                        'IScheck, '+
                        'Capacityhours,'+
                        Add_DeptCode+
                        'onlydefaultwh,'+
                        'Itemcreatetime,'+
                        'Itemmodifytime,'+
                        'remArk,'+
                        'ScrApType,'+
                        sql_Itemdisabletime+
                        'AssetKmCode,'+
                        'ItemClass1,'+
                        'ItemClass2,'+
                        'ItemClass3,'+
                        'ItemClass4,'+
                        'ItemClass5,'+
                        'ClassCode,'+
                        'ProductClass,'+
                        'InspecTEmployeeCode,'+
                        'QcClass,'+
                        'ISStockItem ) '+
            'Values ('''+Edt_ItemCode.text+''','+
                     ''''+edt_ItemName.text+''','+
                     quotedstr(Trim(edt_mat.text))+','+
//                     ''''+edt_ItemshortName.text+''','+
                     ''''+Extedt_UomCode.text+''','+
                     Add_Str_EmployeeCode+
                     Add_Str_WhCode+
                     Add_Str_Pla_EmployeeCode+
                     Add_Str_Wh_EmployeeCode+
                     inttostr(cmbbx_ItemType.Itemindex)+','+
                     ''''+edt_Designno.text+''','+
                     inttostr(cmbbx_ItemUsable.Itemindex)+','+
                     edt_maxqty.text+','+
                     edt_minqty.text+','+
                     inttostr(cmbbx_limitout.Itemindex)+','+
                     edt_Purchldtime.text+','+
                     edt_PrepareLT.text+','+
                     edt_RunLT.text+','+
                     edt_QcLT.text+','+
                     edt_Mnldtime.text+','+
                     inttostr(cmbbx_PmCode.Itemindex)+','+
                     edt_PmBatch.text+','+
                     ''''+Extedt_BarCode.text+''','+
                     ''''+Extedt_ItemCode2.text+''','+
                     inttostr(cmbbx_CanSale.Itemindex)+','+
                     inttostr(cmbbx_Batchstrat.Itemindex)+','+
                     inttostr(cmbbx_BatchCtrl.Itemindex)+','+
                     inttostr(cmbbx_LongPurchLT.Itemindex)+','+
                     inttostr(cmbbx_IScheck.Itemindex)+','+
                     edt_Capacityhours.text+','+
                     Add_Str_DeptCode+
                     inttostr(cmbbx_onlydefaultwh.Itemindex)+','+
                     ''''+formatdatetime('yyyy.mm.dd hh:mm:ss',now)+''','+
                     ''''+formatdatetime('yyyy.mm.dd hh:mm:ss',now)+''','+
                     ''''+edt_remArk.text+''','+
                     ''''+inttostr(Cmbbx_ScrApType.ItemIndex+1)+''','+
                     str_Itemdisabletime+
                     sAssetKmCode1+','+
                     ''''+edt_ItemClass1.text+''','+
                     ''''+edt_ItemClass2.text+''','+
                     ''''+edt_ItemClass3.text+''','+
                     ''''+edt_ItemClass4.text+''','+
                     ''''+edt_ItemClass5.text+''','+
                     'null,'+
                     ''''+edt_ProductClass.text+''','+
                     ' Case When LTrim(RTrim('''+Trim(LEdt_InspecTEmployeeCode.Text)+'''))='''' Then Null '+
                     ' Else '''+Trim(LEdt_InspecTEmployeeCode.Text)+''' end ,'+
                     ''''+edt_QcClass.text+''','+
                     inttostr(Cmbbx_ISStockItem.Itemindex)+')';
      ExecSQL;
    end
  end
  else
  begin
    with AdoQry_Tmp do
    begin
      Close;
      SQL.clear;
      if edt_ClassCode.Text<>'' then
          sql.Text :='update Item set '+
                        'ItemCode='''+Edt_ItemCode.text+''','+
                        'ItemName='''+edt_ItemName.text+''','+
                        'Material='+quotedstr(Trim(edt_mat.text))+','+
//                      'ItemshortName='''+edt_ItemshortName.text+''','+
                        'UomCode='''+Extedt_UomCode.text+''','+
                        modify_Str_EmployeeCode+
                        modify_Str_WhCode+
                        modify_Str_Pla_EmployeeCode+
                        modify_Str_Wh_EmployeeCode+
                        'ItemType='+inttostr(cmbbx_ItemType.Itemindex)+','+
                        'designno='''+edt_Designno.text+''','+
                        'ItemUsable='+inttostr(cmbbx_ItemUsable.Itemindex)+','+
                        'maxqty='+edt_maxqty.text+','+
                        'minqty='+edt_minqty.text+','+
                        'limitout='+inttostr(cmbbx_limitout.Itemindex)+','+
                        'purchldtime='+edt_Purchldtime.text+','+
                        'PrepareLT='+edt_PrepareLT.text+','+
                        'RunLT='+edt_RunLT.text+','+
                        'QcLT='+edt_QcLT.text+','+
                        'mnldtime='+edt_Mnldtime.text+','+
                        'PmCode='+inttostr(cmbbx_PmCode.Itemindex)+','+
                        'PmBatch='+edt_PmBatch.text+','+
                        'BarCode='''+Extedt_BarCode.text+''','+
                        'ItemCode2='''+Extedt_ItemCode2.text+''','+
                        'remArk='''+edt_remArk.text+''','+
                        'ScrApType='''+inttostr(Cmbbx_ScrApType.ItemIndex+1)+''','+
                        'canSale='+inttostr(cmbbx_CanSale.Itemindex)+','+
                        'Batchstrat='+inttostr(cmbbx_Batchstrat.Itemindex)+','+
                        'BatchCtrl='+inttostr(cmbbx_BatchCtrl.Itemindex)+','+
                        'LongPurchLT='+inttostr(cmbbx_LongPurchLT.Itemindex)+','+
                        'IScheck='+inttostr(cmbbx_IScheck.Itemindex)+','+
                        'Capacityhours='''+edt_Capacityhours.text+''','+
                        modify_Str_DeptCode+
                        'onlydefaultwh='+inttostr(cmbbx_onlydefaultwh.Itemindex)+','+
                        // 'Itemmodifytime='''+formatdatetime('yyyy.mm.dd hh:mm:ss',now)+''','+
                        Itemmodifytime+
                         str_ModifyItemdisabletime+
                         sAssetKmCode+','+
                         'ItemClass1='''+edt_ItemClass1.text+''','+
                        'ItemClass2='''+edt_ItemClass2.text+''','+
                        'ItemClass3='''+edt_ItemClass3.text+''','+
                        'ItemClass4='''+edt_ItemClass4.text+''','+
                        'ItemClass5='''+edt_ItemClass5.text+''','+
                        'ClassCode='''+edt_ClassCode.text+''','+
                        'ProductClass='''+edt_ProductClass.text+''','+
                        'QcClass='''+edt_QcClass.text+''','+
                        'ISStockItem='+inttostr(Cmbbx_ISStockItem.ItemIndex)+','+
                        'InspecTEmployeeCode=Case When LTrim(RTrim('''+Trim(LEdt_InspecTEmployeeCode.Text)+'''))='''' Then Null '+
                        ' Else '''+Trim(LEdt_InspecTEmployeeCode.Text)+''' end '+
                ' where ItemCode='''+AdoQry_Item.fieldbyname('ItemCode').asstring+''''
         else
      sql.Text :='update Item set '+
                        'ItemCode='''+Edt_ItemCode.text+''','+
                        'ItemName='''+edt_ItemName.text+''','+
                        'Material='+quotedstr(Trim(edt_mat.text))+','+
//                      'ItemshortName='''+edt_ItemshortName.text+''','+
                        'UomCode='''+Extedt_UomCode.text+''','+
                        modify_Str_EmployeeCode+
                        modify_Str_WhCode+
                        modify_Str_Pla_EmployeeCode+
                        modify_Str_Wh_EmployeeCode+
                        'ItemType='+inttostr(cmbbx_ItemType.Itemindex)+','+
                        'designno='''+edt_Designno.text+''','+
                        'ItemUsable='+inttostr(cmbbx_ItemUsable.Itemindex)+','+
                        'maxqty='+edt_maxqty.text+','+
                        'minqty='+edt_minqty.text+','+
                        'limitout='+inttostr(cmbbx_limitout.Itemindex)+','+
                        'purchldtime='+edt_Purchldtime.text+','+
                        'PrepareLT='+edt_PrepareLT.text+','+
                        'RunLT='+edt_RunLT.text+','+
                        'QcLT='+edt_QcLT.text+','+
                        'mnldtime='+edt_Mnldtime.text+','+
                        'PmCode='+inttostr(cmbbx_PmCode.Itemindex)+','+
                        'PmBatch='+edt_PmBatch.text+','+
                        'BarCode='''+Extedt_BarCode.text+''','+
                        'ItemCode2='''+Extedt_ItemCode2.text+''','+
                        'remArk='''+edt_remArk.text+''','+
                        'ScrApType='''+inttostr(Cmbbx_ScrApType.ItemIndex+1)+''','+
                        'canSale='+inttostr(cmbbx_CanSale.Itemindex)+','+
                        'Batchstrat='+inttostr(cmbbx_Batchstrat.Itemindex)+','+
                        'BatchCtrl='+inttostr(cmbbx_BatchCtrl.Itemindex)+','+
                        'LongPurchLT='+inttostr(cmbbx_LongPurchLT.Itemindex)+','+
                        'IScheck='+inttostr(cmbbx_IScheck.Itemindex)+','+
                        'Capacityhours='''+edt_Capacityhours.text+''','+
                        modify_Str_DeptCode+
                        'onlydefaultwh='+inttostr(cmbbx_onlydefaultwh.Itemindex)+','+
                        // 'Itemmodifytime='''+formatdatetime('yyyy.mm.dd hh:mm:ss',now)+''','+
                        Itemmodifytime+
                         str_ModifyItemdisabletime+
                         sAssetKmCode+','+
                         'ItemClass1='''+edt_ItemClass1.text+''','+
                        'ItemClass2='''+edt_ItemClass2.text+''','+
                        'ItemClass3='''+edt_ItemClass3.text+''','+
                        'ItemClass4='''+edt_ItemClass4.text+''','+
                        'ItemClass5='''+edt_ItemClass5.text+''','+
                        'ClassCode=null,'+
                        'ProductClass='''+edt_ProductClass.text+''','+
                        'QcClass='''+edt_QcClass.text+''', '+
                        'ISStockItem='+inttostr(Cmbbx_ISStockItem.ItemIndex)+','+
                        'InspecTEmployeeCode=Case When LTrim(RTrim('''+Trim(LEdt_InspecTEmployeeCode.Text)+'''))='''' Then Null '+
                        ' Else '''+Trim(LEdt_InspecTEmployeeCode.Text)+''' end '+
           ' where ItemCode='''+AdoQry_Item.fieldbyname('ItemCode').asstring+'''';
      ExecSQL;
    end
  end;
  //给AdoQry_Item各字段赋值
  with AdoQry_Maintain do
  begin
    if Frm_Bas_Item_All.cbx_ShowAll.Checked then
    begin
      fieldbyname('ItemCode').asstring:=Edt_ItemCode.text;
  //    fieldbyname('ItemshortName').asstring:=Edt_ItemshortName.text;
      if Trim(ExtEdt_EmployeeCode.text)<>'' then
      begin
        fieldbyname('EmployeeCode').asstring:=ExtEdt_EmployeeCode.text;
        fieldbyname('CaiGou').asstring:=lbl_CaiGou.Caption;
      end
      else
      begin
        fieldbyname('EmployeeCode').asstring:='';
        fieldbyname('CaiGou').asstring:='';
      end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -