zzr99
2021-12-20 c9521814f494493441254a887a706de4321dfd40
增加根据盘点分析报表,点击审核按钮,生成对应领用出库单
1个文件已修改
376 ■■■■■ 已修改文件
WebAPI/Controllers/基础资料/基础资料/Gy_StockCheckItemBillController.cs 376 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_StockCheckItemBillController.cs
@@ -258,20 +258,20 @@
        {
            DataSet ds;
            List<object> list = new List<object>();
            List<object> list1 = new List<object>();
            List<object> list2 = new List<object>();
            List<object> list3 = new List<object>();
            List<object> list4 = new List<object>();
            List<object> list5 = new List<object>();
            List<object> list6 = new List<object>();
            List<object> list7 = new List<object>();
            List<object> list1 = new List<object>();//正常
            List<object> list2 = new List<object>();//调拨
            List<object> list3 = new List<object>();//出库
            List<object> list4 = new List<object>();//先做领用退库单,再做领用出库单
            List<object> list5 = new List<object>();//盘盈
            List<object> list6 = new List<object>();//盘亏
            List<object> list7 = new List<object>();//退库
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                string sql;
                if (sWhere != null&&sWhere!="")
                {
                     sql = string.Format(@"select k.HBarCode æ¡ç ,s.HName ç›˜ç‚¹æ–¹æ¡ˆ,
                     sql = string.Format(@"select k.HBarCode æ¡ç ,m.HNumber å™¨å…·ç¼–号,s.HName ç›˜ç‚¹æ–¹æ¡ˆ,
                        case when k.HCorrespondentTypeID=1 then '供应商' when k.HCorrespondentTypeID=2 then '客户' when k.HCorrespondentTypeID=4 then '仓库' end å®žé™…位置类型,
                        case when k.HCorrespondentTypeID=1 then p.HName when  k.HCorrespondentTypeID=2 then c.HName when k.HCorrespondentTypeID=4 then w.HName end å®žé™…位置,
                        case when m.HNowSupTypeID=1 then '供应商' when m.HNowSupTypeID=2 then '客户' when m.HNowSupTypeID=4 then '仓库' end è´¦é¢ä½ç½®ç±»åž‹,
@@ -289,7 +289,7 @@
                }
                else
                {
                     sql = string.Format(@"select k.HBarCode æ¡ç ,s.HName ç›˜ç‚¹æ–¹æ¡ˆ,
                     sql = string.Format(@"select k.HBarCode æ¡ç ,m.HNumber å™¨å…·ç¼–号,s.HName ç›˜ç‚¹æ–¹æ¡ˆ,
                        case when k.HCorrespondentTypeID=1 then '供应商' when k.HCorrespondentTypeID=2 then '客户' when k.HCorrespondentTypeID=4 then '仓库' end å®žé™…位置类型,
                        case when k.HCorrespondentTypeID=1 then p.HName when  k.HCorrespondentTypeID=2 then c.HName when k.HCorrespondentTypeID=4 then w.HName end å®žé™…位置,
                        case when m.HNowSupTypeID=1 then '供应商' when m.HNowSupTypeID=2 then '客户' when m.HNowSupTypeID=4 then '仓库' end è´¦é¢ä½ç½®ç±»åž‹,
@@ -419,5 +419,363 @@
            }
        }
        #endregion
        #region ç›˜ç‚¹åˆ†æžå®¡æ ¸
        #region è°ƒæ‹¨â€”直接调拨
            [Route("Gy_StockCheckItemBill/MakeProdMove")]
            [HttpGet]
            public object MakeProdMove(string HBarCode, string user, string userID)
        {
            try
            {
                string HBillNo = "";
                Int64 HInterID = 0;//显示的字段
                ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                DataRow dr = ds.Tables[0].Rows[0];
                HInterID = DBUtility.ClsPub.CreateBillID("3814", ref DBUtility.ClsPub.sExeReturnInfo);
                HBillNo = DBUtility.ClsPub.CreateBillCode("3814", ref DBUtility.ClsPub.sExeReturnInfo, true);
                string sql = "Insert Into Sc_MouldStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HMaker,HMakeDate" + /*"HYear, HPeriod,"*/
                ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('3814','3814'," + HInterID + ",'" + HBillNo + "',getdate()" +
                ", '" + user + "',getdate()" +
                ", " + dr["HSupID"].ToString() + ", 1," + dr["HWhID"].ToString() + ",0,0,0,0" +
                ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
                ") ";
                string sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub   (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,
                HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HPropertyID,HSecUnitRate,HSecUnitID,HUnitID,
                HBatchNo,HQtyMust,HQty,HPrice,HMoney,HDesignLife,HLeaveLife,HUseLife,HWHID,HSCWHID,HSPID,HSCSPID,HSPGroupID,HCorrespondentTypeID,HCorrespondentID,
                HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID) values(" + HInterID + ",1,'',getdate(),0,'',0,0,'',''," +
                "0,0," + dr["HInterID"].ToString() + ",0,0,0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr["HProdQty"].ToString() + ",0," +
                "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr["HWHID"].ToString() + ",0," + dr["HSPID"].ToString() + ",0,0"
                + ",0,0," + userID + ",0,0,'')");
                //主表
                oCn.RunProc(sql);
                oCn.RunProc(sql1);
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "审核成功!";
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "初始化失败!";
                objJsonResult.data = null;
            }
            return objJsonResult;
        }
        #endregion
        #region ç›˜ç›ˆâ€”其他入库单
        [Route("Gy_StockCheckItemBill/MakeOtherIn")]
        [HttpGet]
        public object MakeOtherIn(string HBarCode, string user, string userID)
        {
            try
            {
                string HBillNo = "";
                Int64 HInterID = 0;//显示的字段
                ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                DataRow dr = ds.Tables[0].Rows[0];
                HInterID = DBUtility.ClsPub.CreateBillID("3827", ref DBUtility.ClsPub.sExeReturnInfo);
                HBillNo = DBUtility.ClsPub.CreateBillCode("3827", ref DBUtility.ClsPub.sExeReturnInfo, true);
                string sql = "Insert Into Sc_MouldStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HMaker,HMakeDate" + /*"HYear, HPeriod,"*/
                ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('3827','3827'," + HInterID + ",'" + HBillNo + "',getdate()" +
                ", '" + user + "',getdate()" +
                ", " + dr["HSupID"].ToString() + ", 1," + dr["HWhID"].ToString() + ",0,0,0,0" +
                ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
                ") ";
                string sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub   (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,
                HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HPropertyID,HSecUnitRate,HSecUnitID,HUnitID,
                HBatchNo,HQtyMust,HQty,HPrice,HMoney,HDesignLife,HLeaveLife,HUseLife,HWHID,HSCWHID,HSPID,HSCSPID,HSPGroupID,HCorrespondentTypeID,HCorrespondentID,
                HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID) values(" + HInterID + ",1,'',getdate(),0,'',0,0,'',''," +
                "0,0," + dr["HInterID"].ToString() + ",0,0,0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr["HProdQty"].ToString() + ",0," +
                "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr["HWHID"].ToString() + ",0," + dr["HSPID"].ToString() + ",0,0"
                + ",0,0," + userID + ",0,0,'')");
                //主表
                oCn.RunProc(sql);
                oCn.RunProc(sql1);
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "审核成功!";
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "初始化失败!";
                objJsonResult.data = null;
            }
            return objJsonResult;
        }
        #endregion
        #region ç›˜äºâ€”处理出库单
        [Route("Gy_StockCheckItemBill/MakeScrapOut")]
        [HttpGet]
        public object MakeScrapOut(string HBarCode, string user, string userID)
        {
            try
            {
                string HBillNo = "";
                Int64 HInterID = 0;//显示的字段
                ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                DataRow dr = ds.Tables[0].Rows[0];
                HInterID = DBUtility.ClsPub.CreateBillID("3832", ref DBUtility.ClsPub.sExeReturnInfo);
                HBillNo = DBUtility.ClsPub.CreateBillCode("3832", ref DBUtility.ClsPub.sExeReturnInfo, true);
                string sql = "Insert Into Sc_MouldStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HMaker,HMakeDate" + /*"HYear, HPeriod,"*/
                ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('3832','3832'," + HInterID + ",'" + HBillNo + "',getdate()" +
                ", '" + user + "',getdate()" +
                ", " + dr["HSupID"].ToString() + ", 1," + dr["HWhID"].ToString() + ",0,0,0,0" +
                ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
                ") ";
                string sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub   (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,
                HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HPropertyID,HSecUnitRate,HSecUnitID,HUnitID,
                HBatchNo,HQtyMust,HQty,HPrice,HMoney,HDesignLife,HLeaveLife,HUseLife,HWHID,HSCWHID,HSPID,HSCSPID,HSPGroupID,HCorrespondentTypeID,HCorrespondentID,
                HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID) values(" + HInterID + ",1,'',getdate(),0,'',0,0,'',''," +
                "0,0," + dr["HInterID"].ToString() + ",0,0,0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr["HProdQty"].ToString() + ",0," +
                "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr["HWHID"].ToString() + ",0," + dr["HSPID"].ToString() + ",0,0"
                + ",0,0," + userID + ",0,0,'')");
                //主表
                oCn.RunProc(sql);
                oCn.RunProc(sql1);
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "审核成功!";
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "初始化失败!";
                objJsonResult.data = null;
            }
            return objJsonResult;
        }
        #endregion
        #region å‡ºåº“—领用出库单
        [Route("Gy_StockCheckItemBill/MakeProdOut")]
        [HttpGet]
        public object MakeProdOut(string HBarCode, string user, string userID)
        {
            try
            {
                string HBillNo = "";
                Int64 HInterID = 0;//显示的字段
                ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                DataRow dr = ds.Tables[0].Rows[0];
                HInterID = DBUtility.ClsPub.CreateBillID("3802", ref DBUtility.ClsPub.sExeReturnInfo);
                HBillNo = DBUtility.ClsPub.CreateBillCode("3802", ref DBUtility.ClsPub.sExeReturnInfo, true);
                string sql = "Insert Into Sc_MouldStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HMaker,HMakeDate" + /*"HYear, HPeriod,"*/
                ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('3802','3802'," + HInterID + ",'" + HBillNo + "',getdate()" +
                ", '" + user + "',getdate()" +
                ", " + dr["HSupID"].ToString() + ", 1," + dr["HWhID"].ToString() + ",0,0,0,0" +
                ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
                ") ";
                string sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub   (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,
                HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HPropertyID,HSecUnitRate,HSecUnitID,HUnitID,
                HBatchNo,HQtyMust,HQty,HPrice,HMoney,HDesignLife,HLeaveLife,HUseLife,HWHID,HSCWHID,HSPID,HSCSPID,HSPGroupID,HCorrespondentTypeID,HCorrespondentID,
                HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID) values(" + HInterID + ",1,'',getdate(),0,'',0,0,'',''," +
                "0,0," + dr["HInterID"].ToString() + ",0,0,0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr["HProdQty"].ToString() + ",0," +
                "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr["HWHID"].ToString() + ",0," + dr["HSPID"].ToString() + ",0,0"
                + ",0,0," + userID + ",0,0,'')");
                //主表
                oCn.RunProc(sql);
                oCn.RunProc(sql1);
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "审核成功!";
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "初始化失败!";
                objJsonResult.data = null;
            }
            return objJsonResult;
        }
        #endregion
        #region é€€åº“—领用退库单
        [Route("Gy_StockCheckItemBill/MakeProdBack")]
        [HttpGet]
        public object MakeProdBack(string HBarCode, string user, string userID)
        {
            try
            {
                string HBillNo = "";
                Int64 HInterID = 0;//显示的字段
                ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                DataRow dr = ds.Tables[0].Rows[0];
                HInterID = DBUtility.ClsPub.CreateBillID("3803", ref DBUtility.ClsPub.sExeReturnInfo);
                HBillNo = DBUtility.ClsPub.CreateBillCode("3803", ref DBUtility.ClsPub.sExeReturnInfo, true);
                string sql = "Insert Into Sc_MouldStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HMaker,HMakeDate" + /*"HYear, HPeriod,"*/
                ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('3803','3803'," + HInterID + ",'" + HBillNo + "',getdate()" +
                ", '" + user + "',getdate()" +
                ", " + dr["HSupID"].ToString() + ", 1," + dr["HWhID"].ToString() + ",0,0,0,0" +
                ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
                ") ";
                string sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub   (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,
                HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HPropertyID,HSecUnitRate,HSecUnitID,HUnitID,
                HBatchNo,HQtyMust,HQty,HPrice,HMoney,HDesignLife,HLeaveLife,HUseLife,HWHID,HSCWHID,HSPID,HSCSPID,HSPGroupID,HCorrespondentTypeID,HCorrespondentID,
                HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID) values(" + HInterID + ",1,'',getdate(),0,'',0,0,'',''," +
                "0,0," + dr["HInterID"].ToString() + ",0,0,0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr["HProdQty"].ToString() + ",0," +
                "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr["HWHID"].ToString() + ",0," + dr["HSPID"].ToString() + ",0,0"
                + ",0,0," + userID + ",0,0,'')");
                //主表
                oCn.RunProc(sql);
                oCn.RunProc(sql1);
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "审核成功!";
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "初始化失败!";
                objJsonResult.data = null;
            }
            return objJsonResult;
        }
        #endregion
        #region å…ˆé¢†ç”¨é€€åº“再领用出库
        [Route("Gy_StockCheckItemBill/MakeProdOutBack")]
        [HttpGet]
        public object MakeProdOutBack(string HBarCode, string user, string userID)
        {
            try
            {
                string HBillNo = "";
                Int64 HInterID = 0;//显示的字段
                ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                DataRow dr = ds.Tables[0].Rows[0];
                //出库
                HInterID = DBUtility.ClsPub.CreateBillID("3802", ref DBUtility.ClsPub.sExeReturnInfo);
                HBillNo = DBUtility.ClsPub.CreateBillCode("3802", ref DBUtility.ClsPub.sExeReturnInfo, true);
                string sql = "Insert Into Sc_MouldStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HMaker,HMakeDate" + /*"HYear, HPeriod,"*/
                ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('3802','3802'," + HInterID + ",'" + HBillNo + "',getdate()" +
                ", '" + user + "',getdate()" +
                ", " + dr["HSupID"].ToString() + ", 1," + dr["HWhID"].ToString() + ",0,0,0,0" +
                ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
                ") ";
                string sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub   (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,
                HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HPropertyID,HSecUnitRate,HSecUnitID,HUnitID,
                HBatchNo,HQtyMust,HQty,HPrice,HMoney,HDesignLife,HLeaveLife,HUseLife,HWHID,HSCWHID,HSPID,HSCSPID,HSPGroupID,HCorrespondentTypeID,HCorrespondentID,
                HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID) values(" + HInterID + ",1,'',getdate(),0,'',0,0,'',''," +
                "0,0," + dr["HInterID"].ToString() + ",0,0,0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr["HProdQty"].ToString() + ",0," +
                "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr["HWHID"].ToString() + ",0," + dr["HSPID"].ToString() + ",0,0"
                + ",0,0," + userID + ",0,0,'')");
                //退库
                HInterID = DBUtility.ClsPub.CreateBillID("3803", ref DBUtility.ClsPub.sExeReturnInfo);
                HBillNo = DBUtility.ClsPub.CreateBillCode("3803", ref DBUtility.ClsPub.sExeReturnInfo, true);
                string sql2 = "Insert Into Sc_MouldStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HMaker,HMakeDate" + /*"HYear, HPeriod,"*/
                ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('3803','3803'," + HInterID + ",'" + HBillNo + "',getdate()" +
                ", '" + user + "',getdate()" +
                ", " + dr["HSupID"].ToString() + ", 1," + dr["HWhID"].ToString() + ",0,0,0,0" +
                ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
                ") ";
                string sql3 = string.Format(@"Insert Into Sc_MouldStockBillSub   (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,
                HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HPropertyID,HSecUnitRate,HSecUnitID,HUnitID,
                HBatchNo,HQtyMust,HQty,HPrice,HMoney,HDesignLife,HLeaveLife,HUseLife,HWHID,HSCWHID,HSPID,HSCSPID,HSPGroupID,HCorrespondentTypeID,HCorrespondentID,
                HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID) values(" + HInterID + ",1,'',getdate(),0,'',0,0,'',''," +
                "0,0," + dr["HInterID"].ToString() + ",0,0,0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr["HProdQty"].ToString() + ",0," +
                "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr["HWHID"].ToString() + ",0," + dr["HSPID"].ToString() + ",0,0"
                + ",0,0," + userID + ",0,0,'')");
                //主表
                oCn.RunProc(sql);
                oCn.RunProc(sql1);
                oCn.RunProc(sql2);
                oCn.RunProc(sql3);
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "审核成功!";
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "初始化失败!";
                objJsonResult.data = null;
            }
            return objJsonResult;
        }
        #endregion
        #endregion
    }
}