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

📄 bas_item_d.pas

📁 一个MRPII系统源代码版本
💻 PAS
📖 第 1 页 / 共 4 页
字号:
    end;
    if AdoQry_Item.fieldbyname('whCode').asstring<>Extedt_WhCode.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('onlydefaultwh').asinteger<>cmbbx_onlydefaultwh.Itemindex then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('maxqty').asstring<>Edt_maxqty.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('minqty').asstring<>Edt_minqty.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('limitout').asinteger<>cmbbx_limitout.Itemindex then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('purchldtime').asstring<>Edt_Purchldtime.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('PrepareLT').asstring<>Edt_PrepareLT.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('RunLT').asstring<>Edt_RunLT.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('QcLT').asstring<>Edt_QcLT.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('mnldtime').asstring<>Edt_Mnldtime.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('PmCode').asinteger<>cmbbx_PmCode.Itemindex then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('Batchstrat').asinteger<>cmbbx_Batchstrat.Itemindex then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('PmBatch').asstring<>Edt_PmBatch.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('DeptCode').asstring<>edt_DeptCode.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('BarCode').asstring<>Extedt_BarCode.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('BatchCtrl').asinteger<>cmbbx_BatchCtrl.Itemindex then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('Capacityhours').asstring<>edt_Capacityhours.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('canSale').asinteger<>cmbbx_CanSale.Itemindex then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('ItemCode2').asstring<>Extedt_ItemCode2.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('remArk').asstring<>edt_remArk.text then
    begin
      canmodify_remArk:=True;
    end;
    if AdoQry_Item.fieldbyname('ItemClass1').asstring<>Edt_ItemClass1.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('ItemClass2').asstring<>Edt_ItemClass2.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('ItemClass3').asstring<>Edt_ItemClass3.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('ItemClass4').asstring<>Edt_ItemClass4.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('ItemClass5').asstring<>Edt_ItemClass5.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if  canmodify_Itemmodifytime=True then
       Itemmodifytime:=' Itemmodifytime='''+formatdatetime('yyyy.mm.dd hh:mm:ss',now)+''','
    else
       Itemmodifytime:='';
    if AdoQry_Item.fieldbyname('ClassCode').asstring<>Edt_ClassCode.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('ProductClass').asstring<>Edt_ProductClass.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;
    if AdoQry_Item.fieldbyname('QcClass').asstring<>Edt_QcClass.text then
    begin
      canmodify_Itemmodifytime:=True;
    end;

  end;

  //控制采购员代码,当其为空时不能增加,修改
  if Trim(ExtEdt_EmployeeCode.Text)='' then
  begin
    Add_EmployeeCode:='';
    Add_Str_EmployeeCode:='';
    modify_Str_EmployeeCode:='EmployeeCode=null,';
  end
  else
  begin
    Add_EmployeeCode:='EmployeeCode,';
    Add_Str_EmployeeCode:=''''+Extedt_EmployeeCode.text+''',';
    modify_Str_EmployeeCode:='EmployeeCode='''+Extedt_EmployeeCode.text+''',';
  end;
  //控制计划员代码,当其为空时不增加,修改
 if Trim(ExtEdt_Pla_EmployeeCode.Text)='' then
  begin
    Add_Pla_EmployeeCode:='';
    Add_Str_Pla_EmployeeCode:='';
    modify_Str_Pla_EmployeeCode:='Pla_EmployeeCode=null,';
  end
  else
  begin
    Add_Pla_EmployeeCode:='Pla_EmployeeCode,';
    Add_Str_Pla_EmployeeCode:=''''+Extedt_Pla_EmployeeCode.text+''',';
    modify_Str_Pla_EmployeeCode:='Pla_EmployeeCode='''+Extedt_Pla_EmployeeCode.text+''',';
  end;

    //控制缺省仓库管理员
 if Trim(ExtEdt_Wh_EmployeeCode.Text)='' then
  begin
    Add_Wh_EmployeeCode:='';
    Add_Str_Wh_EmployeeCode:='';
    modify_Str_Wh_EmployeeCode:='wh_EmployeeCode=null,';
  end
  else
  begin
    Add_Wh_EmployeeCode:='wh_EmployeeCode,';
    Add_Str_Wh_EmployeeCode:=''''+Extedt_Wh_EmployeeCode.text+''',';
    modify_Str_Wh_EmployeeCode:='wh_EmployeeCode='''+Extedt_Wh_EmployeeCode.text+''',';
  end;

  //控制仓库代码,当仓库代码为空时不用增加,修改
  if Trim(ExtEdt_WhCode.Text)='' then
  begin
    Add_WhCode:='';
    Add_Str_WhCode:='';
    modify_Str_WhCode:='whCode=null,';
  end
  else
  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 (Add) and (Character='General') then
  begin
    with AdoQry_Tmp do
    begin
      Close;
      SQL.clear;
      if edt_ClassCode.Text<>'' then
      sql.Text:='Insert Item( '+
                  'ItemCode,'+
                  'ItemName,'+
                  'ItemUsable,'+
                  'UomCode,'+
                  'designno,'+
                  'BarCode,'+
                  'ItemCode2,'+
                  'Material,'+
                  'remArk,'+
                  'Itemcreatetime,'+
                  'Itemdisabletime,'+
                  'ItemClass1,'+
                  'ItemClass2,'+
                  'ItemClass3,'+
                  'ItemClass4,'+
                  'ItemClass5,'+
                  'ClassCode,'+
                  'ProductClass,'+
                  'InspecTEmployeeCode,'+
                  'QcClass)'+
              'Values ('''+Edt_ItemCode.text+''','+
              ''''+edt_ItemName.text+''','+
              '0,'+
              ''''+Extedt_UomCode.text+''','+
              ''''+Edt_Designno.text+''','+
              ''''+Extedt_BarCode.text+''','+
              ''''+Extedt_ItemCode2.text+''','+
              quotedstr(Trim(edt_mat.text))+','+
              ''''+edt_remArk.text+''', '+
              ''''+formatdatetime('yyyy.mm.dd hh:mm:ss',now)+''','+
              ''''+formatdatetime('yyyy.mm.dd hh:mm:ss',now)+''','+
              ''''+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+''')'
          else
      sql.Text:='Insert Item( '+
                  'ItemCode,'+
                  'ItemName,'+
                  'ItemUsable,'+
                  'UomCode,'+
                  'designno,'+
                  'BarCode,'+
                  'ItemCode2,'+
                  'Material,'+
                  'remArk,'+
                  'Itemcreatetime,'+
                  'Itemdisabletime,'+
                  'ItemClass1,'+
                  'ItemClass2,'+
                  'ItemClass3,'+
                  'ItemClass4,'+
                  'ItemClass5,'+
                  'ClassCode,'+
                  'ProductClass,'+
                  'InSpecTEmployeeCode,'+
                  'QcClass)'+
              'Values ('''+Edt_ItemCode.text+''','+
              ''''+edt_ItemName.text+''','+
              '0,'+
              ''''+Extedt_UomCode.text+''','+
              ''''+Edt_Designno.text+''','+
              ''''+Extedt_BarCode.text+''','+
              ''''+Extedt_ItemCode2.text+''','+
              quotedstr(Trim(edt_mat.text))+','+
              ''''+edt_remArk.text+''', '+
              ''''+formatdatetime('yyyy.mm.dd hh:mm:ss',now)+''','+
              ''''+formatdatetime('yyyy.mm.dd hh:mm:ss',now)+''','+
              ''''+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+''')';
      ExecSQL;
    end
  end;

  if (not (Add)) and (Character='General') then
  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+''','+
            'UomCode='''+Extedt_UomCode.text+''','+
            'designno='''+edt_Designno.text+''','+
            'BarCode='''+Extedt_BarCode.text+''','+
            'ItemCode2='''+Extedt_ItemCode2.text+''','+
            'Material='+quotedstr(Trim(edt_mat.text))+','+
            'remArk='''+edt_remArk.text+''','+
            Itemmodifytime+
            '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+''', '+
            '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+''','+
            'UomCode='''+Extedt_UomCode.text+''','+
            'designno='''+edt_Designno.text+''','+
            'BarCode='''+Extedt_BarCode.text+''','+
            'ItemCode2='''+Extedt_ItemCode2.text+''','+
            'Material='+quotedstr(Trim(edt_mat.text))+','+
            'remArk='''+edt_remArk.text+''','+
            Itemmodifytime+
            '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+''', '+
            '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;

  if (not (Add)) and (Character='Plan') then
  begin
    with AdoQry_Tmp do
    begin
      Close;
      SQL.clear;
      sql.Text:='update Item set '+
            'ItemType='+inttostr(cmbbx_ItemType.Itemindex)+','+
            'PmCode='+inttostr(cmbbx_PmCode.Itemindex)+','+
            modify_Str_EmployeeCode+
            modify_Str_Pla_EmployeeCode+
            'BatchCtrl='+inttostr(cmbbx_BatchCtrl.Itemindex)+','+
            'LongPurchLT='+inttostr(cmbbx_LongPurchLT.Itemindex)+','+
            'iScheck='+inttostr(cmbbx_iScheck.Itemindex)+','+
            'purchldtime='+edt_Purchldtime.text+','+
            'mnldtime='+edt_Mnldtime.text+','+
            'RunLT='+edt_RunLT.text+','+
            Itemmodifytime+
            'PrepareLT='+edt_PrepareLT.text+','+
            'QcLT='+edt_QcLT.text+','+
            'Batchstrat='+inttostr(cmbbx_Batchstrat.Itemindex)+','+
            'PmBatch='+edt_PmBatch.text+','+
             modify_Str_DeptCode+
            'Capacityhours='''+edt_Capacityhours.text+''','+
            '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;

  if (not (Add)) and (Character='Warehouse') then
  begin
    with AdoQry_tmp do
    begin
      Close;
      sql.clear;
      sql.Text:='Update Item  set '+
           modify_Str_WhCode+
           'onlydefaultwh='+inttostr(cmbbx_onlydefaultwh.Itemindex)+','+
           modify_Str_Wh_EmployeeCode+
           Itemmodifytime+
           'maxqty='+edt_maxqty.text+','+
           'minqty='+edt_minqty.text+','+
           'limitout='+inttostr(cmbbx_limitout.Itemindex)+','+
           'canSale='+inttostr(cmbbx_CanSale.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.cbx_ShowAll.Checked then
    begin
      if (Character='General') then
      begin
        if (Add) then
        begin
          fieldbyname('Itemcreatetime').asdatetime:=now;
          fieldbyname('Itemdisabletime').asdatetime:=now;
          fieldbyname('ItemUsable').asinteger:=0;
        end;
        fieldbyname('BarCode').asstring:=ExtEdt_BarCode.text;
        fieldbyname('ItemCode').asstring:=Edt_ItemCode.text;
        fieldbyname('designno').asstring:=Edt_Designno.text;
        fieldbyname('ItemName').asstring:=Edt_ItemName.text;
        fieldbyname('UomCode').asstring:=ExtEdt_UomCode.text;
        fieldbyname('UomName').asstring:=lbl_UomName.Caption;
        fieldbyname('Material').asstring:=Trim(edt_mat.text);
        fieldbyname('remArk').asstring:=Edt_remArk.text;
        fieldbyname('ItemCode2').asstring:=ExtEdt_ItemCode2.text;
        fieldbyname('ItemClass1').asstring:=Edt_ItemClass1.text;
        fieldbyname('ItemClass2').asstring:=Edt_ItemClass2.text;
        fieldbyname('ItemClass3').asstring:=Edt_ItemClass3.text;
        fieldbyname('ItemClass4').asstring:=Edt_ItemClass4.text;
        fieldbyname('ItemClass5').asstring:=Edt_ItemClass5.text;
        fieldbyname('ClassCode').asstring:=Edt_ClassCode.text;
        fieldbyname('ClassName').asstring:=lbl_ClassName.Caption;
        fieldbyname('ProductClass').asstring:=Edt_ProductClass.text;
        fieldbyname('QcClass').asstring:=Edt_QcClass.text;

⌨️ 快捷键说明

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