yangle
2022-06-30 1cf37e52dcefd6bbf567818b50e16f36c7fae84c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using DBUtility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace DAL
{
    public  class ClsGy_BarCodeBill_ChaiMa : DBUtility.ClsGy_Base_Ctl
    {
        public Model.ClsGy_BarCodeEdit_Model omodel = new Model.ClsGy_BarCodeEdit_Model();
        public List<Model.ClsGy_BarCodeEdit_Model> DetailColl_Mater = new List<Model.ClsGy_BarCodeEdit_Model>();
        public List<Model.ClsGy_BarCodeEdit_Model> DetailColl_Pay = new List<Model.ClsGy_BarCodeEdit_Model>();
 
 
        public  bool AddBill(ref string sReturn,string HBillNo)
        {
            try
            {
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                string sql = "update Gy_BarCodeBill set HStopflag=1,HStopMan='"+ ClsPub.CurUserName + "',HStopManDate=getdate() where HBarCode='" + HBillNo + "'";
                oCn.RunProc(sql);
                ////插入子表
                foreach (Model.ClsGy_BarCodeEdit_Model oSub in DetailColl_Mater)
                {
                    string sql2 = "Insert Into Gy_BarCodeBill   " +
                "(HInterID,HEntryID,HBillType,HProcID,HBarCode,HBarCodeType,HItemSubID" +
                ",HMaterID,HUnitID,HPieceQty,HQty,HBatchNo,HSupID,HGroupID,HDeptID,HEmpID" +
                ",HMaker,HMakeDate,HPrintQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
                ",HRemark,HUseFlag,HEndQty,HWei,HStopflag,HBarCodeStatus,HReadyQty,HinitQty,HAuxPropID" +
                ",HMTONo,HSupflag,HEndDate,HSourceID,HCusType,HWorkLineName,HCusID,HSTOCKORGID,HOWNERID" +
                ",HJiaYe,HPressModel,HCusModel,HMaterialModel,HColor,HLogo,HPackageSize,HMaterialJQty" +
                ",HMaterialMQty,HCustomBatchNo,HBarCodeDate,HGBBarCode,HOLDBarCodeFlag,HOldSourceInterID" +
                ",HOldSourceEntryID,HOldSourceBillNo,HOrderInterID,HOrderEntryID,HOrderBillNo,HOrderBillType" +
                ",HRelationNum,HLabelQty,HMinQty,HNowQty,HStopMan,HInStockDate_XF,HExpressNumber,POOrderBillNo" +
                ",HICMOReportBillNo,HInStockCounts,HReportCounts,HOutStockCounts,HInStockBillNo,HOutStockBillNo" +
                ",HSendGoodsBillNo,HServerItemID,HBadReasonList,HProdLev,HInnerBillNo,HCusBarCode,HStatus,HInitSourceEntryID" +
                ",HOldSourceBillType,HMZ,HGiveAwayFlag" +
                ") " +
                " values("+ oSub.HInterID + ",1,'3710',0,'" + oSub.HBarCode + "','" + oSub.HBarCodeType + "','" + oSub.HItemSubID+
                "'," + oSub.HMaterID + ","+ oSub.HUnitID + ",0,"+ oSub.HQty + ",'"+oSub.HBatchNo + "',"+ oSub.HSupID + "," + oSub.HGroupID + "," + oSub.HDeptID + "," + oSub.HEmpID +
                ",'" + oSub.HMaker + "','" + oSub.HMakeDate + "',0," + oSub.HSourceInterID + ","+ oSub.HSourceEntryID + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," +
                "'','" + oSub.HUseFlag + "','','',0,'',0,"+ oSub.HInitQty+",0"+
                ",'',0,'',"+ oSub.HSourceID+",'','',"+ oSub.HCusID+","+ oSub.HSTOCKORGID+","+ oSub.HOWNERID + 
                ",'','','','','','','',0,"+
                "0,'','"+oSub.HBarCodeDate+"','',0,0"+
                ",0,'',0,0,'',''"+
                ",'',0,0,0,'','','',''"+
                ",'',0,0,0,'',''"+
                ",'',0,'','','"+oSub.HInnerBillNo+"','','',0,''"+
                ","+ oSub.HMZ+",0"+
                ") ";
                    oCn.RunProc(sql2);
                }
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
    }
}