ch
2022-11-03 c761ba5bd72e9170c65fad44003e90a61e034b33
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_StockCheckItemBillController.cs
@@ -26,22 +26,23 @@
            try
            {
                ds = StockCheckItemList(sWhere);
                if (ds == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询数据异常,请与管理员联系!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "返回记录成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
                //}
                //else
                //{
                //objJsonResult.code = "0";
                //objJsonResult.count = 0;
                //objJsonResult.Message = "无数据";
                //objJsonResult.data = null;
                //return objJsonResult;
                //}
            }
            catch (Exception ex)
            {
@@ -206,7 +207,7 @@
                    ",HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HMakeTime,HMakeEmp,HEndDate,HOrgID) " +
                    " Values('" + oBill.HNumber + "','" + oBill.HName + "','" + oBill.HHelpCode + "','" + oBill.HShortNumber + "'," + oBill.HParentID.ToString() +
                    "," + oBill.HLevel.ToString() + "," + Convert.ToString(oBill.HEndFlag ? 1 : 0) + "," + Convert.ToString(oBill.HStopflag ? 1 : 0) + ",'" + oBill.HRemark +
                    "','" + oBill.HUseFlag + "',getdate(),'" + msg3 + "','" + oBill.HEndDate.ToString() + "'," + oBill.HOrgID.ToString()+
                    "','" + oBill.HUseFlag + "',getdate(),'" + msg3 + "','" + oBill.HEndDate.ToString() + "'," + oBill.HOrgID.ToString() +
                    ")", ref DBUtility.ClsPub.sExeReturnInfo);
                    //修改上级为非末级代码
                    oCn.RunProc("Update Gy_StockCheckItem set HEndflag=0 where HItemID=" + oBill.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
@@ -251,10 +252,80 @@
        }
        #endregion
        #region ç›˜ç‚¹åˆ†æžåˆ—表判断当前选择的盘点方案是否生成过单据
        [Route("Gy_StockCheckItemBill/StockItemSubIsExistence")]
        [HttpGet]
        public object StockItemSubIsExistence(string sID)
        {
            try
            {
                DataSet ds;
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                string sql;
                sql = string.Format(@"select * from Gy_StockCheckItemSub where HInterID=" + sID);
                ds = oCN.RunProcReturn(sql, "Gy_StockCheckItemSub");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "暂未生成";
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "已生成";
                    return objJsonResult;
                }
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç›˜ç‚¹åˆ†æžåˆ—表 åˆ é™¤ ä¸éœ€è¦çš„æ•°æ®
        [Route("Gy_StockCheckItemBill/StockItemSubDel")]
        [HttpGet]
        public object StockItemSubDel(string sID)
        {
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //oCn.BeginTran();
                //oCN.RunProc("exec h_p_StockItemSubDel " + sID);
                //oCn.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception ex)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç›˜ç‚¹åˆ†æžåˆ—表
        [Route("Gy_StockCheckItemBill/Get_InventoryAnalysisList")]
        [HttpGet]
        public object Get_InventoryAnalysisList(string sWhere,string sID)
        public object Get_InventoryAnalysisList(string sWhere, string sID)
        {
            DataSet ds;
            List<object> list = new List<object>();
@@ -262,17 +333,33 @@
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //判断是否选择盘点方案,是=>(用盘点方案子表做对比),否=>(用器具档案做对比)
                if (sID == null || sID == "")
                {
                    sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisList where " + sWhere);
                    if (sWhere == "pk")
                    {
                        sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisPK");
                    }
                    else
                    {
                        sql = string.Format($"exec h_p_Sc_MouldInventoryAnalysisList2  '{sWhere}'");
                    }
                }
                else
                {
                    sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisList where " + sWhere + " and HSourceInterID=(select HItemID from Gy_StockCheckItem where HItemID=" + sID + ") and HMakeDate<=(select HEndDate from Gy_StockCheckItem where HItemID=" + sID + ")");
                    if (sWhere == "pk")
                    {
                        sql = string.Format($"exec h_p_Sc_MouldInventoryAnalysisPK  '{sID}'");
                    }
                    else
                    {
                        sql = string.Format($"exec h_p_Sc_MouldInventoryAnalysisList  '{sID}','{sWhere}'");
                    }
                }
                ds = oCN.RunProcReturn(sql, "Sc_MouldStockBillMain_Temp");
                ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldInventoryAnalysisList");
                list.Add(ds.Tables[0]);
                objJsonResult.code = "0";
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "获取信息成功!";
                objJsonResult.list = list;
@@ -297,22 +384,23 @@
            try
            {
                ds = MouldStockBillMainTemp(sWhere);
                if (ds == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询数据异常,请与管理员联系!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "返回记录成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
                //}
                //else
                //{
                //objJsonResult.code = "0";
                //objJsonResult.count = 0;
                //objJsonResult.Message = "无数据";
                //objJsonResult.data = null;
                //return objJsonResult;
                //}
            }
            catch (Exception ex)
            {
@@ -329,11 +417,11 @@
            string sql1 = string.Format(@"select * from h_v_Gy_MouldStockBillMainTempList where 1=1 ");
            if (sWhere == null || sWhere.Equals(""))
            {
                return new SQLHelper.ClsCN().RunProcReturn(sql1 + sWhere + " order by åˆ¶å•日期 desc", "h_v_Gy_MouldStockBillMainTempList");
                return new SQLHelper.ClsCN().RunProcReturn(sql1 + sWhere + " order by hitemid desc", "h_v_Gy_MouldStockBillMainTempList");
            }
            else
            {
                string sql = sql1 + sWhere + "order by åˆ¶å•日期 desc";
                string sql = sql1 + sWhere + "order by hitemid desc";
                return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Gy_MouldStockBillMainTempList");
            }
        }
@@ -380,55 +468,86 @@
        #region ç›˜ç‚¹åˆ†æžå®¡æ ¸
        #region è°ƒæ‹¨â€”直接调拨
        [Route("Gy_StockCheckItemBill/MakeProdMove")]
            [HttpGet]
            public object MakeProdMove(string HBarCode, string user, string userID,string HItemID)
        [HttpPost]
        public object MakeProdMove([FromBody] JObject msg)
        {
            try
            {
                string HBillNo = "";
                Int64 HInterID = 0;//显示的字段
                DataSet ds1 = new DataSet();
                ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='"+ HItemID+"'", "Sc_MouldStockBillMain_Temp");
                DataRow dr = ds.Tables[0].Rows[0];
                DataRow dr1 = ds1.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" +
                ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('3814','3814'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
                ", '" + 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["HMaterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr["HProdQty"].ToString() + ",0," +
                "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0"
                + ",0,0,0," + userID + ",0,0,'')");
                //主表
                oCn.RunProc(sql);
                oCn.RunProc(sql1);
                var _value = msg["msg"].ToString();
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string msg2 = sArray[0].ToString();//表格数据
                string user = sArray[1].ToString();//user
                string userID = sArray[2].ToString();//userID
                string sName = sArray[3].ToString();//盘点方案
                //查询盘点方案创建日期
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem");
                string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString();
                //转化格式
                ListModels oListModels = new ListModels();
                List<Models.Cls_InventoryAnalysisList> lsmain = new List<Models.Cls_InventoryAnalysisList>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_Gy_StockCheckItemBill(msg2);
                foreach (Models.Cls_InventoryAnalysisList item in lsmain)
                {
                    var HBarCode = item.HBarCode;
                    var HItemID = item.HItemID;
                    string HBillNo = "";
                    Int64 HInterID = 0;//显示的字段
                    DataSet ds1 = new DataSet();
                    ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                    ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp");
                    DataRow dr = ds.Tables[0].Rows[0];
                    DataRow dr1 = ds1.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,HRemark" +
                    ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                    ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                    ") " +
                    " values('3814','3814'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    ", '" + user + "','" + HDate + "','" + sName + "'" +
                    ", " + dr["HSupID"].ToString() + ", 1," + dr["HNowSupID"].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,'" + sName.ToString() + "',0,0,'',''," +
                    "0,0," + dr["HInterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr1["HQty"].ToString() + ",0," +
                    "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0"
                    + ",0,0,0," + userID + ",0,100005,'')");
                    //主表
                    oCn.BeginTran();
                    oCn.RunProc(sql);
                    oCn.RunProc(sql1);
                    oCn.RunProc("update Sc_MouldStockBillMain_Temp set HCheckStatus=1 where HitemID=" + HItemID);
                    //修改器具档案位置
                    string sql2 = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'in','{HInterID.ToString()}' ");
                    oCn.RunProc(sql2);
                    oCn.Commit();
                }
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "审核成功!";
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "初始化失败!";
                objJsonResult.Message = e.Message;
                objJsonResult.data = null;
            }
            return objJsonResult;
@@ -438,54 +557,87 @@
        #region ç›˜ç›ˆâ€”其他入库单
        [Route("Gy_StockCheckItemBill/MakeOtherIn")]
        [HttpGet]
        public object MakeOtherIn(string HBarCode, string user, string userID, string HItemID)
        [HttpPost]
        public object MakeOtherIn([FromBody] JObject msg)
        {
            try
            {
                string HBillNo = "";
                Int64 HInterID = 0;//显示的字段
                DataSet ds1 = new DataSet();
                ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp");
                DataRow dr = ds.Tables[0].Rows[0];
                DataRow dr1 = ds1.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" +
                ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('3827','3827'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
                ", '" + 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["HMaterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr["HProdQty"].ToString() + ",0," +
                "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + ",0,0,0"
                + ",0,0,0," + userID + ",0,0,'')");
                //主表
                oCn.RunProc(sql);
                oCn.RunProc(sql1);
                var _value = msg["msg"].ToString();
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string msg2 = sArray[0].ToString();//表格数据
                string user = sArray[1].ToString();//user
                string userID = sArray[2].ToString();//userID
                string sName = sArray[3].ToString();//盘点方案
                //查询盘点方案创建日期
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem");
                string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString();
                //转化格式
                ListModels oListModels = new ListModels();
                List<Models.Cls_InventoryAnalysisList> lsmain = new List<Models.Cls_InventoryAnalysisList>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_Gy_StockCheckItemBill(msg2);
                foreach (Models.Cls_InventoryAnalysisList item in lsmain)
                {
                    var HBarCode = item.HBarCode;
                    var HItemID = item.HItemID;
                    string HBillNo = "";
                    Int64 HInterID = 0;//显示的字段
                    DataSet ds1 = new DataSet();
                    ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                    ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp");
                    DataRow dr = ds.Tables[0].Rows[0];
                    DataRow dr1 = ds1.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,HRemark" +
                    ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                    ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                    ") " +
                    " values('3827','3827'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    ", '" + user + "','" +HDate + "','" + sName + "'" +
                    ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + ",isnull('" + dr["HNowSupID"].ToString() + "',0),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,'" + sName.ToString() + "',0,0,'',''," +
                    "0,0," + dr["HInterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr1["HQty"].ToString() + ",0," +
                    "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0"
                    + ",0,0,0," + userID + ",0,100005,'')");
                    //主表
                    oCn.BeginTran();
                    oCn.RunProc(sql);
                    oCn.RunProc(sql1);
                    oCn.RunProc("update Sc_MouldStockBillMain_Temp set HCheckStatus=1 where HitemID=" + HItemID);
                    //修改器具档案位置
                    string sql2 = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'in','{HInterID.ToString()}' ");
                    oCn.RunProc(sql2);
                    oCn.Commit();
                }
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "审核成功!";
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "初始化失败!";
                objJsonResult.Message = e.Message;
                objJsonResult.data = null;
            }
            return objJsonResult;
@@ -495,54 +647,110 @@
        #region ç›˜äºâ€”处理出库单
        [Route("Gy_StockCheckItemBill/MakeScrapOut")]
        [HttpGet]
        public object MakeScrapOut(string HBarCode, string user, string userID, string HItemID)
        [HttpPost]
        public object MakeScrapOut([FromBody] JObject msg)
        {
            try
            {
                string HBillNo = "";
                Int64 HInterID = 0;//显示的字段
                DataSet ds1 = new DataSet();
                ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp");
                DataRow dr = ds.Tables[0].Rows[0];
                DataRow dr1 = ds1.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" +
                ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('3832','3832'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
                ", '" + 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["HMaterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr["HProdQty"].ToString() + ",0," +
                "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + ",0,0,0"
                + ",0,0,0," + userID + ",0,0,'')");
                //主表
                oCn.RunProc(sql);
                oCn.RunProc(sql1);
                var _value = msg["msg"].ToString();
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string msg2 = sArray[0].ToString();//表格数据
                string user = sArray[1].ToString();//user
                string userID = sArray[2].ToString();//userID
                string sName = sArray[3].ToString();//盘点方案
                //查询盘点方案创建日期
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem");
                string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString();
                //转化格式
                ListModels oListModels = new ListModels();
                List<Models.Cls_InventoryAnalysisList> lsmain = new List<Models.Cls_InventoryAnalysisList>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_Gy_StockCheckItemBill(msg2);
                foreach (Models.Cls_InventoryAnalysisList item in lsmain)
                {
                    var HBarCode = item.HBarCode;
                    var HItemID = item.HItemID;
                    string HBillNo = "";
                    string sql, sql1;
                    Int64 HInterID = 0;//显示的字段
                    HInterID = DBUtility.ClsPub.CreateBillID("3828", ref DBUtility.ClsPub.sExeReturnInfo);
                    HBillNo = DBUtility.ClsPub.CreateBillCode("3828", ref DBUtility.ClsPub.sExeReturnInfo, true);
                    DataSet ds1 = new DataSet();
                    ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                    DataRow dr = ds.Tables[0].Rows[0];
                    if (HItemID == 0)
                    {
                        sql = "Insert Into Sc_MouldStockBillMain   " +
                   "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                   ",HMaker,HMakeDate,HRemark" +
                   ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                   ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                   ") " +
                   " values('3828','3828'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                   ", '" + user + "','"+ HDate + "','" + sName + "'" +
                   ",0,0," + dr["HNowSupID"].ToString() + ",0,0,0,0" +
                   ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
                   ") ";
                        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,'" + sName.ToString() + "',0,0,'',''," +
                   "0,0," + dr["HInterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + ",0,0," +
                   "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + ",0,0,0,0"
                   + ",0,0,0," + userID + ",0,100005,'')");
                    }
                    else
                    {
                        ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp");
                        DataRow dr1 = ds1.Tables[0].Rows[0];
                        sql = "Insert Into Sc_MouldStockBillMain   " +
                       "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                       ",HMaker,HMakeDate,HRemark" +
                       ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                       ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                       ") " +
                       " values('3832','3832'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                       ", '" + user + "',getdate()" + ",'" + sName + "'" +
                       ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" +
                       ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
                       ") ";
                        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,'" + sName.ToString() + "',0,0,'',''," +
                       "0,0," + dr["HInterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr1["HQty"].ToString() + ",0," +
                       "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0"
                       + ",0,0,0," + userID + ",0,100005,'')");
                    }
                    //主表
                    oCn.BeginTran();
                    oCn.RunProc(sql);
                    oCn.RunProc(sql1);
                    oCn.RunProc("update Sc_MouldStockBillMain_Temp set HCheckStatus=1 where HitemID=" + HItemID);
                    //修改器具档案位置
                    string sql2 = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'out','{HInterID.ToString()}' ");
                    oCn.RunProc(sql2);
                    oCn.Commit();
                }
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "审核成功!";
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "初始化失败!";
                objJsonResult.Message = e.Message;
                objJsonResult.data = null;
            }
            return objJsonResult;
@@ -552,41 +760,71 @@
        #region å‡ºåº“—领用出库单
        [Route("Gy_StockCheckItemBill/MakeProdOut")]
        [HttpGet]
        public object MakeProdOut(string HBarCode, string user, string userID, string HItemID)
        [HttpPost]
        public object MakeProdOut([FromBody] JObject msg)
        {
            try
            {
                string HBillNo = "";
                Int64 HInterID = 0;//显示的字段
                DataSet ds1 = new DataSet();
                ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp");
                DataRow dr = ds.Tables[0].Rows[0];
                DataRow dr1 = ds1.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" +
                ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('3802','3802'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
                ", '" + 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["HMaterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr["HProdQty"].ToString() + ",0," +
                "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + ",0,0,0"
                + ",0,0,0," + userID + ",0,0,'')");
                //主表
                oCn.RunProc(sql);
                oCn.RunProc(sql1);
                var _value = msg["msg"].ToString();
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string msg2 = sArray[0].ToString();//表格数据
                string user = sArray[1].ToString();//user
                string userID = sArray[2].ToString();//userID
                string sName = sArray[3].ToString();//盘点方案
                //查询盘点方案创建日期
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem");
                string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString();
                //转化格式
                ListModels oListModels = new ListModels();
                List<Models.Cls_InventoryAnalysisList> lsmain = new List<Models.Cls_InventoryAnalysisList>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_Gy_StockCheckItemBill(msg2);
                foreach (Models.Cls_InventoryAnalysisList item in lsmain)
                {
                    var HBarCode = item.HBarCode;
                    var HItemID = item.HItemID;
                    string HBillNo = "";
                    Int64 HInterID = 0;//显示的字段
                    DataSet ds1 = new DataSet();
                    ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                    ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp");
                    DataRow dr = ds.Tables[0].Rows[0];
                    DataRow dr1 = ds1.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,HRemark" +
                    ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                    ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                    ") " +
                    " values('3802','3802'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    ", '" + user + "','" +HDate + "','" + sName + "'" +
                    ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + "," + dr["HNowSupID"].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,'" + sName.ToString() + "',0,0,'',''," +
                    "0,0," + dr["HInterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr1["HQty"].ToString() + ",0," +
                    "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + ",'1548785'," + dr["HNowSupID"].ToString() + ",0,0"
                    + ",0,0,0," + userID + ",0,100005,'')");
                    //主表
                    oCn.BeginTran();
                    oCn.RunProc(sql);
                    oCn.RunProc(sql1);
                    oCn.RunProc("update Sc_MouldStockBillMain_Temp set HCheckStatus=1 where HitemID=" + HItemID);
                    //修改器具档案位置
                    string sql2 = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'out','{HInterID.ToString()}' ");
                    oCn.RunProc(sql2);
                    oCn.Commit();
                }
                objJsonResult.code = "0";
                objJsonResult.count = 1;
@@ -597,9 +835,10 @@
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "初始化失败!";
                objJsonResult.Message = e.Message;
                objJsonResult.data = null;
            }
            return objJsonResult;
@@ -609,41 +848,71 @@
        #region é€€åº“—领用退库单
        [Route("Gy_StockCheckItemBill/MakeProdBack")]
        [HttpGet]
        public object MakeProdBack(string HBarCode, string user, string userID, string HItemID)
        [HttpPost]
        public object MakeProdBack([FromBody] JObject msg)
        {
            try
            {
                string HBillNo = "";
                Int64 HInterID = 0;//显示的字段
                DataSet ds1 = new DataSet();
                ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp");
                DataRow dr = ds.Tables[0].Rows[0];
                DataRow dr1 = ds1.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" +
                ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('3803','3803'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
                ", '" + 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["HMaterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr["HProdQty"].ToString() + ",0," +
                "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + ",0,0,0"
                + ",0,0,0," + userID + ",0,0,'')");
                //主表
                oCn.RunProc(sql);
                oCn.RunProc(sql1);
                var _value = msg["msg"].ToString();
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string msg2 = sArray[0].ToString();//表格数据
                string user = sArray[1].ToString();//user
                string userID = sArray[2].ToString();//userID
                string sName = sArray[3].ToString();//盘点方案
                //查询盘点方案创建日期
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem");
                string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString();
                //转化格式
                ListModels oListModels = new ListModels();
                List<Models.Cls_InventoryAnalysisList> lsmain = new List<Models.Cls_InventoryAnalysisList>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_Gy_StockCheckItemBill(msg2);
                foreach (Models.Cls_InventoryAnalysisList item in lsmain)
                {
                    var HBarCode = item.HBarCode;
                    var HItemID = item.HItemID;
                    string HBillNo = "";
                    Int64 HInterID = 0;//显示的字段
                    DataSet ds1 = new DataSet();
                    ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                    ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp");
                    DataRow dr = ds.Tables[0].Rows[0];
                    DataRow dr1 = ds1.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,HRemark" +
                    ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                    ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                    ") " +
                    " values('3803','3803'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    ", '" + user + "','" +HDate + "','" + sName + "'" +
                    ", " + dr["HNowSupID"].ToString() + "," + dr["HNowSupTypeID"].ToString() + "," + dr["HNowSupID"].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,'" + sName.ToString() + "',0,0,'',''," +
                    "0,0," + dr["HInterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr1["HQty"].ToString() + ",0," +
                    "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0"
                    + ",0,0,0," + userID + ",0,100005,'')");
                    //主表
                    oCn.BeginTran();
                    oCn.RunProc(sql);
                    oCn.RunProc(sql1);
                    oCn.RunProc("update Sc_MouldStockBillMain_Temp set HCheckStatus=1 where HitemID=" + HItemID);
                    //修改器具档案位置
                    string sql2 = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'in','{HInterID.ToString()}' ");
                    oCn.RunProc(sql2);
                    oCn.Commit();
                }
                objJsonResult.code = "0";
                objJsonResult.count = 1;
@@ -651,12 +920,14 @@
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "初始化失败!";
                objJsonResult.Message = e.Message;
                objJsonResult.data = null;
            }
            return objJsonResult;
@@ -666,11 +937,11 @@
        #region å…ˆé¢†ç”¨é€€åº“再领用出库
        [Route("Gy_StockCheckItemBill/MakeProdOutBack")]
        [HttpGet]
        public object MakeProdOutBack(string HBarCode, string user, string userID, string HItemID)
        [HttpPost]
        public object MakeProdOutBack([FromBody] JObject msg)
        {
            MakeProdBack(HBarCode, user, userID, HItemID);
            MakeProdOut(HBarCode, user, userID, HItemID);
            MakeProdBack(msg);
            MakeProdOut(msg);
            objJsonResult.code = "0";
            objJsonResult.count = 1;
            objJsonResult.Message = "审核成功!";
@@ -679,6 +950,8 @@
            return objJsonResult;
        }
        #endregion
        #endregion
    }
}