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

📄 u_form_producestock.~pas

📁 这是一个啤酒行业的软件
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
         _AdoNewProduce.actionRecord(strsql,param);
       
     end; ////不存在则,添加品种
   end;///if _str.save

   {/*
      初始化控件内容
   */}
   combobox1.Text:='';
   combobox2.Text:='';
   combobox3.Text:='';
   combobox4.Text:='';
   edit2.Text:='0';
   edit3.Text:='0';
   edit4.Text:='0';
   {/*
        在表格中显示数据//////////////////////
   */}
    param.Clear;
    param.Add(trim(makeDate.text));
    param.Add(_whichStore);
    strSql:='select SI_IntoBillCode,SI_IntoDate,SI_intoTime,SI_productName,SI_specification,SI_UnitName,SI_productNum,SI_EmptyBoxNum,';
    strSql:=strSql+'SI_bottleNum,SI_WhichStore,SI_StoreMan  from  sale_IntoStore  where SI_intoDate=:s1 and SI_whichStore=:s2  order by SI_IntoBillCode';
    _AdoNewproduce.BindToGrid(grid1,strSql,param);
    {/*
        自动计算编号
    */}
    param.Clear;
    param.Add('RK');
    param.Add(trim(_whichStore));
    param.Add(trim(makeDate.text));
    strSql:='select * from  sale_IntoStore  where substring(SI_intoBillCode,1,2)=:s1  ';
    strsql:=strsql+' and  SI_whichStore=:s2  and  SI_intodate=:s3';
    _RsCount:=_AdoNewProduce.getRecordCount(strSql,param);
    if  (_RsCount>=0) and (_RsCount<9) then
    begin
        _BillCode:='00'+intToStr(_RsCount+1)
    end;
    if  (_RsCount>=9) and (_RsCount<99) then
    begin
        _BillCode:='0'+intToStr(_RsCount+1)
    end;
    if  (_RsCount>=99) and (_RsCount<999) then
    begin
        _BillCode:=intToStr(_RsCount+1)
    end;

    edit1.Text:='RK'+trim(FormatdateTime('yyyymmdd',now))+'_'+trim(_whichStore)+trim(_BillCode);

end;

procedure TForm_ProduceStock.Grid1DblClick(Sender: TObject);
begin
      edit1.Text:=trim(grid1.cells[1,grid1.row].ForeText);

      F_BillCode:=trim(grid1.cells[1,grid1.row].ForeText);
      F_BoxNum:=strToInt(trim(grid1.cells[7,grid1.row].ForeText));
      F_EmptyBoxNum:=strToInt(trim(grid1.cells[8,grid1.row].ForeText));
      F_BottleNum:=strToInt(trim(grid1.cells[9,grid1.row].ForeText));

      Makedate.Text:=trim(grid1.cells[2,grid1.row].ForeText);
      combobox1.Text:=trim(grid1.cells[4,grid1.row].ForeText);
      combobox2.Text:=trim(grid1.cells[5,grid1.row].ForeText);
      combobox3.Text:=trim(grid1.cells[6,grid1.row].ForeText);

      F_productName:=trim(grid1.cells[4,grid1.row].ForeText);
      F_Specification:=trim(grid1.cells[5,grid1.row].ForeText);
      F_UnitName:=trim(grid1.cells[6,grid1.row].ForeText);

      edit2.Text:=trim(grid1.cells[7,grid1.row].ForeText);
      edit3.Text:=trim(grid1.cells[8,grid1.row].ForeText);
      edit4.Text:=trim(grid1.cells[9,grid1.row].ForeText);
      Opendate1.Time:=strToTime(trim(grid1.cells[3,grid1.row].ForeText));
      if grid1.Cells[10,grid1.row].foretext='B' then
      begin
         combobox4.Text:='一线酒库';
      end;///
      combobox5.Text:=trim(grid1.cells[11,grid1.row].ForeText);
end;

procedure TForm_ProduceStock.BtnEditClick(Sender: TObject);
var
   param:TStringList;
   strsql:string;

   _NewProductNum:integer;
   _NewEmptyBoxNum:integer;
   _NewBottleNum:integer;

   _StoreNum:integer;
   _bottleNum:integer;
   _EmptyBoxNum:integer;

   _OrderID:integer;
   _BillCode:string;
   _rsCount:integer;
begin
   param:=TStringList.Create;
   param.Clear;
   {/*
       验证更改的必要性
   */}
   if not _check.Do_Control(edit2,1,'成套数量不能为空,修改无效...') then exit;
   if not _check.Do_Control(edit3,1,'空箱数量不能为空,修改无效...') then exit;
   if not _check.Do_Control(edit4,1,'瓶数量不能为空,修改无效...') then exit;
   {/*
       得到新的数量
   */}
   if edit2.text<>'' then
   begin
       _NewproductNum:=strToInt(edit2.text)-F_BoxNum;
   end;
   if  edit3.text<>'' then
   begin
       _NewEmptyBoxNum:=strToInt(edit3.text)-F_EmptyBoxNum;
   end;
   if edit4.text<>'' then
   begin
       _NewBottleNum:=strToInt(edit4.text)-F_BottleNum;
   end;    
   if _str.updateMessage then
   begin
      param.clear;
      param.Add(trim(MakeDate.text));                        /////1.
      param.Add(TimeToStr(opendate1.Time));                  /////2.
      param.Add(trim(combobox1.text));                       /////3.
      param.Add(trim(combobox2.text));                       /////4.
      param.Add(trim(combobox3.text));                       /////5.
      param.Add(trim(edit2.text));                           /////6.成套数量
      param.Add(trim(edit3.text));                           /////7.空箱数量
      param.Add(trim(edit4.text));                           /////8.瓶数量
      param.Add(trim(_WhichStore));                          /////9.
      param.Add(trim(combobox5.text));                       /////10.
      param.Add(trim(F_Billcode));                           /////11.
      param.Add(trim(_WhichStore));
      strsql:='update  sale_intoStore  set  SI_Intodate=:s1,SI_IntoTime=:s2,SI_ProductName=:s3,SI_specification=:s4,';
      strsql:=strsql+'SI_unitName=:s5,SI_productNum=:s6,SI_EmptyBoxNum=:s7,SI_BottleNum=:s8,SI_WhichStore=:s9,SI_StoreMan=:s10  ';
      strsql:=strsql+' where  SI_IntoBillCode=:s11  and  SI_whichStore=:s12';
      _adoNewProduce.actionRecord(strsql,param);
    end;//_str.update
    {/*
            首先得到原来库存的数量,然后存储到_StoreNum变量中
    */}
      param.clear;                                                 ////清除查询条件
      param.Add(_whichStore);                                      ////1.添加酒库名称/////////
      param.Add(trim(F_Productname));                              ////2.产品名称
      param.Add(trim(F_Specification));                            ////3.规格//////
      param.Add(trim(F_UnitName));                                 ////4.包装//////////
      strSql:='select *  from  sale_storage Where  WhichStore=:s1  and  ';
      strsql:=strsql+' produceName=:s2  and Specification=:s3 and  UnitName=:s4 ';
      _StoreNum:=_AdoNewProduce.getFieldValue(strsql,param,'boxNum');
      _bottleNum:=_AdoNewProduce.getFieldValue(strsql,param,'bottleNum');
      _EmptyBoxNum:=_AdoNewProduce.getFieldValue(strsql,param,'EmptyBoxNum');
      //showmessage(inttostr(_storeNum));
      {/*
          修改库存中的数量
      */}
       param.clear;
       param.Add(inttostr(_StoreNum+_NewProductNum));               ////1.修改整箱数量
       param.Add(inttostr(_bottleNum+_NewBottleNum));               ////2.修改整瓶数量
       param.Add(inttostr(_EmptyBoxNum+_newEmptyBoxNum));           ////3.修改整瓶数量
       param.Add(_whichStore);                                      ////4.添加酒库名称/////////
       param.Add(trim(F_Productname));                              ////5.产品名称
       param.Add(trim(F_Specification));                             ////6.规格//////
       param.Add(trim(F_UnitName));                                  ////7.包装//////////
       strSql:='update sale_storage set boxNum=:s1,bottleNum=:s2,EmptyBoxNum=:s3  Where  WhichStore=:s4  ';
       strsql:=strsql+' and  produceName=:s5 and Specification=:s6  and  UnitName=:s7';
       _AdoNewProduce.actionRecord(strSql,param);
   {/*
      初始化控件内容
   */}
   combobox1.Text:='';
   combobox2.Text:='';
   combobox3.Text:='';
   combobox4.Text:='';
   edit2.Text:='0';
   edit3.Text:='0';
   edit4.Text:='0';
   {/*
        在表格中显示数据//////////////////////
   */}
    param.Clear;
    param.Add(trim(makeDate.text));
    param.Add(_whichStore);
    strSql:='select SI_IntoBillCode,SI_IntoDate,SI_intoTime,SI_productName,SI_specification,SI_UnitName,SI_productNum,SI_EmptyBoxNum,';
    strSql:=strSql+'SI_bottleNum,SI_WhichStore,SI_StoreMan  from  sale_IntoStore  where SI_intoDate=:s1 and SI_whichStore=:s2  order by SI_IntoBillCode';
    _AdoNewproduce.BindToGrid(grid1,strSql,param);
    {/*
        自动计算编号
    */}
    param.Clear;
    param.Add('RK');
    param.Add(trim(_whichStore));
    param.Add(trim(makeDate.text));
    strSql:='select * from  sale_IntoStore  where substring(SI_intoBillCode,1,2)=:s1  ';
    strsql:=strsql+' and  SI_whichStore=:s2  and  SI_intodate=:s3';
    _RsCount:=_AdoNewProduce.getRecordCount(strSql,param);
    if  (_RsCount>=0) and (_RsCount<9) then
    begin
        _BillCode:='00'+intToStr(_RsCount+1)
    end;
    if  (_RsCount>=9) and (_RsCount<99) then
    begin
        _BillCode:='0'+intToStr(_RsCount+1)
    end;
    if  (_RsCount>=99) and (_RsCount<999) then
    begin
        _BillCode:=intToStr(_RsCount+1)
    end;

    edit1.Text:='RK'+trim(FormatdateTime('yyyymmdd',now))+'_'+trim(_whichStore)+trim(_BillCode);
    grid1.Refresh;

end;

procedure TForm_ProduceStock.FormShow(Sender: TObject);
var
   i,j:integer;
   param:TStringList;
   strsql:string;
begin
   for i:=2 to grid1.RowCount-1 do
   begin
       for j:=1 to grid1.ColCount-1 do
       begin
            grid1.Cells[j,i].ForeText:='';
       end;
   end;
   param:=TStringList.create;
   param.clear;
   {/*
        在表格中显示数据//////////////////////
    */}
    param.Clear;
    param.Add(trim(makeDate.text));
    param.Add(_whichStore);
    strSql:='select SI_IntoBillCode,SI_IntoDate,SI_intoTime,SI_productName,SI_specification,SI_UnitName,SI_productNum,SI_EmptyBoxNum,';
    strSql:=strSql+'SI_bottleNum,SI_WhichStore,SI_StoreMan  from  sale_IntoStore  where SI_intoDate=:s1 and SI_whichStore=:s2  order by SI_IntoBillCode';
    _AdoNewproduce.BindToGrid(grid1,strSql,param);
end;

procedure TForm_ProduceStock.BtnDelClick(Sender: TObject);
var
   param:TStringList;
   strsql:string;

   _NewProductNum:integer;
   _NewEmptyBoxNum:integer;
   _NewBottleNum:integer;

   _StoreNum:integer;
   _bottleNum:integer;
   _EmptyBoxNum:integer;

   _OrderID:integer;
   _BillCode:string;
   _rsCount:integer;
begin
   param:=TStringList.Create;
   param.clear;
   {/*
      验证输入数据的
   */}
   if not _Check.Do_Control(edit1,1,'编号不能为空...') then exit;
   {/*
      验证输入此编号的记录是否存在
   */}
   param.clear;
   param.Add(trim(edit1.Text));
   param.Add(trim(_WhichStore));
   strSql:='select * from  sale_IntoStore  Where  SI_intoBillCode=:s1  and  SI_whichStore=:s2';
   if _AdoNewproduce.getRecordCount(strsql,param)<=0 then
   begin
      showmessage('记录不存在,无法删除...');
      exit;
   end;
   {/*
      执行删除操作
   */}
   if _str.deleteMessage  then
   begin
      param.Clear;
      param.Add(trim(F_Billcode));
      param.Add(trim(_WhichStore));
      strsql:='delete   from  sale_IntoStore  where  si_intoBillcode=:s1  and  SI_whichStore=:s2';
      _AdoNewProduce.actionRecord(strsql,param);
   end;//if
   {/*
            首先得到原来库存的数量,然后存储到_StoreNum变量中
    */}
      param.clear;                                                                   ////清除查询条件
      param.Add(_whichStore);                                                        ////1.添加酒库名称/////////
      param.Add(trim(F_Productname));                                                ////2.产品名称
      param.Add(trim(F_Specification));                                              ////3.规格//////
      param.Add(trim(F_UnitName));                                                   ////4.包装//////////
      strSql:='select *  from  sale_Storage Where  WhichStore=:s1  and  ';
      strsql:=strsql+' produceName=:s2  and Specification=:s3 and  UnitName=:s4 ';
      _StoreNum:=_AdoNewProduce.getFieldValue(strsql,param,'boxNum');
      _bottleNum:=_AdoNewProduce.getFieldValue(strsql,param,'bottleNum');
      _EmptyBoxNum:=_AdoNewProduce.getFieldValue(strsql,param,'EmptyBoxNum');
      //showmessage(inttostr(_storeNum));
      {/*
          修改库存中的数量
      */}
       param.clear;
       param.Add(inttostr(_StoreNum-strToInt(edit2.text)));                          ////1.修改整箱数量
       param.Add(inttostr(_bottleNum-strToInt(edit3.text)));                         ////2.修改整瓶数量
       param.Add(inttostr(_EmptyBoxNum-strToInt(edit4.text)));                       ////3.修改整瓶数量
       param.Add(_whichStore);                                                       ////4.添加酒库名称/////////
       param.Add(trim(F_Productname));                                               ////5.产品名称
       param.Add(trim(F_Specification));                                             ////6.规格//////
       param.Add(trim(F_UnitName));                                                  ////7.包装//////////
       strSql:='update sale_storage set boxNum=:s1,bottleNum=:s2,EmptyBoxNum=:s3  Where  WhichStore=:s4  ';
       strsql:=strsql+' and  produceName=:s5 and Specification=:s6  and  UnitName=:s7';
       _AdoNewProduce.actionRecord(strSql,param);
   {/*
      初始化控件内容
   */}
   combobox1.Text:='';
   combobox2.Text:='';
   combobox3.Text:='';
   combobox4.Text:='';
   edit2.Text:='0';
   edit3.Text:='0';
   edit4.Text:='0';
   {/*
        在表格中显示数据//////////////////////
   */}
    param.Clear;
    param.Add(trim(makeDate.text));
    param.Add(_whichStore);
    strSql:='select SI_IntoBillCode,SI_IntoDate,SI_intoTime,SI_productName,SI_specification,SI_UnitName,SI_productNum,SI_EmptyBoxNum,';
    strSql:=strSql+'SI_bottleNum,SI_WhichStore,SI_StoreMan  from  sale_IntoStore  where SI_intoDate=:s1 and SI_whichStore=:s2  order by SI_IntoBillCode';
    _AdoNewproduce.BindToGrid(grid1,strSql,param);
    {/*
        自动计算编号
    */}
    param.Clear;
    param.Add('RK');
    param.Add(trim(_whichStore));
    param.Add(trim(makeDate.text));
    strSql:='select * from  sale_IntoStore  where substring(SI_intoBillCode,1,2)=:s1  ';
    strsql:=strsql+' and  SI_whichStore=:s2  and  SI_intodate=:s3';
    _RsCount:=_AdoNewProduce.getRecordCount(strSql,param);
    if  (_RsCount>=0) and (_RsCount<9) then
    begin
        _BillCode:='00'+intToStr(_RsCount+1)
    end;
    if  (_RsCount>=9) and (_RsCount<99) then
    begin
        _BillCode:='0'+intToStr(_RsCount+1)
    end;
    if  (_RsCount>=99) and (_RsCount<999) then
    begin
        _BillCode:=intToStr(_RsCount+1)
    end;

    edit1.Text:='RK'+trim(FormatdateTime('yyyymmdd',now))+'_'+trim(_whichStore)+trim(_BillCode);
    grid1.Refresh;
    _str.actionOK(at_update);
end;

procedure TForm_ProduceStock.ButtonExCtl1Click(Sender: TObject);
begin
    if Form_ProductStockFind=nil then
    begin
       EnableWindow(Form_ProduceStock.Handle,false);
       Form_ProductStockFind:=TForm_ProductStockFind.Create(Application);
       Form_ProductStockFind.Show;
    end
    else
    begin
       EnableWindow(Form_ProduceStock.Handle,false);
       Form_ProductStockFind.Show;
    end;
end;

end.

⌨️ 快捷键说明

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