WebAPI/Controllers/ÌõÂë¹ÜÀí/WEBSController.cs
@@ -32,6 +32,7 @@
        public WebS.WebService1 oWebs = new WebS.WebService1();
        public WebS.ClsKf_ICStockBill_WMS WebSoBar = new WebS.ClsKf_ICStockBill_WMS();
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        DBUtility.ClsXt_BaseBill oBaseBill = new DBUtility.ClsXt_BaseBill();
        string ComputerName = SystemInformation.ComputerName;   //设备名称
@@ -951,11 +952,18 @@
        /// <returns></returns>
        [Route("WEBSController/GetEquipList_Json")]
        [HttpGet]
        public object GetEquipList_Json(string Equip)
        public object GetEquipList_Json(string Equip,int HCenterID)
        {
            try
            {
                ds = oCn.RunProcReturn("select HInterID,HEquipFileNumber,HName,HSourceID,HSourceName from h_v_Gy_EquipFileBill where HEquipFileNumber like '%" + Equip + "%' or HName like '%" + Equip + "%'", "h_v_Gy_EquipFileBill");
                if (HCenterID !=0)
                {
                    ds = oCn.RunProcReturn("select HInterID,HEquipFileNumber,HName,HSourceID,HSourceName,HCenterID from h_v_Gy_EquipFileBill where HCenterID='"+HCenterID+"' and ( HEquipFileNumber like '%" + Equip + "%' or HName like '%" + Equip + "%')", "h_v_Gy_EquipFileBill");
                }
                else
                {
                    ds = oCn.RunProcReturn("select HInterID,HEquipFileNumber,HName,HSourceID,HSourceName from h_v_Gy_EquipFileBill where HEquipFileNumber like '%" + Equip + "%' or HName like '%" + Equip + "%'", "h_v_Gy_EquipFileBill");
                }
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
@@ -1445,28 +1453,107 @@
        {
            try
            {
                if (oWebs.set_DelPonderationBillMain_Temp_FIFO(HInterID, HBillType, ref DBUtility.ClsPub.sErrInfo))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //成功!
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //失败!
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //更新先进先出临时表状态
                oCn.RunProc("EXEC h_p_WMS_UPDateICInventory_FIFO_Tmp " + HInterID.ToString() + ",'" + HBillType + "'");
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //成功!
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "更新先进先出临时表HlineStatus值失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// å‡ºåº“扫码模块,退出时更新先进先出临时表状态 HlineStatus  20250722
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_DelPonderationBillMain_Temp_FIFO_New_Json")]
        [HttpGet]
        public object set_DelPonderationBillMain_Temp_FIFO_New_Json(long HInterID, string HBillType, Int64 HStockOrgID)
        {
            //获取系统参数
            string sErrMsg = "";
            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
            {
                string sERPMode = oSystemParameter.omodel.WMS_WMSStockCtl_ERPMode;   //库存控制-WMS库存控制ERP模式   (WISE、CLOUD、MES)
                string sFIFOCtl = "N";          //先进先出控制('Y'为控制)
                //生产领料单-先进先出控制
                if (HBillType == "1204" && (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MateOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //销售出库单-先进先出控制
                else if (HBillType == "1205" && (oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_SellOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //其他出库单-先进先出控制
                else if (HBillType == "1206" && (oSystemParameter.omodel.Kf_OtherOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_OtherOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //委外出库单-先进先出控制
                else if (HBillType == "1211" && (oSystemParameter.omodel.Kf_EntrustOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_EntrustOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //直接调拨单-先进先出控制
                else if (HBillType == "1207" && (oSystemParameter.omodel.Kf_MoveStockBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MoveStockBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //分步式调出单-先进先出控制
                else if (HBillType == "1250" && (oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //生产补料单-先进先出控制
                else if (HBillType == "1254" && (oSystemParameter.omodel.Kf_MateReplenishOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MateReplenishOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //委外补料单-先进先出控制
                else if (HBillType == "1255" && (oSystemParameter.omodel.Kf_EntrustReplenishOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_EntrustReplenishOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                try
                {
                    if(sFIFOCtl == "Y")
                    {
                        //更新先进先出临时表状态
                        oCn.RunProc("EXEC h_p_WMS_UPDateICInventory_FIFO_Tmp " + HInterID.ToString() + ",'" + HBillType + "'");
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //成功!
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                catch (Exception e)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "更新先进先出临时表HlineStatus值失败!" + e.ToString();
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "获取系统参数失败! " + sErrMsg;
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -1536,6 +1623,53 @@
            try
            {
                ds = oWebs.GetKf_PonderationBillMain_TempList_New(HBillType, HMaker, HStockOrgID);
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有返回任何记录!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    List<object> columnNameList = new List<object>();
                    //添加列名
                    foreach (DataColumn col in ds.Tables[0].Columns)
                    {
                        Type dataType = col.DataType;
                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //获取到DataColumn列对象的列名
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "获取单据缓存列表信息成功!";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "获取单据缓存列表信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// ç¼“存列表界面,返回缓存列表信息     20250513
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/GetKf_PonderationBillMain_TempList_Other_Json")]
        [HttpGet]
        public object GetKf_PonderationBillMain_TempList_Other_Json(string HBillType, string HMaker, Int64 HStockOrgID, string HSubBillType)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_Other '" + HBillType + "','" + HMaker + "'," + HStockOrgID.ToString() + ",'" + HSubBillType + "'", "h_p_KF_GetPonderationBillMain_TempList_Other");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
@@ -1901,27 +2035,114 @@
        }
        /// <summary>
        /// åˆ é™¤ç¼“存列表单据
        /// åˆ é™¤ç¼“存列表单据,删除时判断单据是否异常,写入日志   20250722
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_DelPonderationBillMain_Temp_Json")]
        [HttpGet]
        public object set_DelPonderationBillMain_Temp_Json(long HInterID, string HBillType)
        public object set_DelPonderationBillMain_Temp_Json(long HInterID, string HBillNo, string HBillType, string HMaker, Int64 HStockOrgID, string MvarReportTitle)
        {
            try
            //获取系统参数
            string sErrMsg = "";
            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
            {
                oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + HBillType + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功";
                objJsonResult.data = null;
                return objJsonResult;
                string sERPMode = oSystemParameter.omodel.WMS_WMSStockCtl_ERPMode;   //库存控制-WMS库存控制ERP模式   (WISE、CLOUD、MES)
                string sFIFOCtl = "N";          //先进先出控制('Y'为控制)
                //生产领料单-先进先出控制
                if (HBillType == "1204" && (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MateOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //销售出库单-先进先出控制
                else if (HBillType == "1205" && (oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_SellOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //其他出库单-先进先出控制
                else if (HBillType == "1206" && (oSystemParameter.omodel.Kf_OtherOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_OtherOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //委外出库单-先进先出控制
                else if (HBillType == "1211" && (oSystemParameter.omodel.Kf_EntrustOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_EntrustOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //直接调拨单-先进先出控制
                else if (HBillType == "1207" && (oSystemParameter.omodel.Kf_MoveStockBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MoveStockBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //分步式调出单-先进先出控制
                else if (HBillType == "1250" && (oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //生产补料单-先进先出控制
                else if (HBillType == "1254" && (oSystemParameter.omodel.Kf_MateReplenishOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MateReplenishOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                //委外补料单-先进先出控制
                else if (HBillType == "1255" && (oSystemParameter.omodel.Kf_EntrustReplenishOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_EntrustReplenishOutBill_FIFOList.ToUpper() == "Y"))
                {
                    sFIFOCtl = "Y";
                }
                try
                {
                    string WorkList = "删除缓存单据,单据号:" + HBillNo;
                    string SystemName = "WMS-" + MvarReportTitle + "模块";
                    oCn.BeginTran();
                    ds = oCn.RunProcReturn("exec h_p_WMS_PonderationBillMain_Temp_Delete " + HInterID + ",'" + HBillNo + "','" + HBillType + "','" + sFIFOCtl + "','" + sERPMode + "'", "h_p_WMS_PonderationBillMain_Temp_Delete");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除缓存单据失败,删除缓存单据判断错误!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;  //失败!
                        objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        //写入日志
                        oCn.RunProc("Insert into  System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " +
                            "(getdate(),'" + HMaker + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','','删除')"
                            );
                        oCn.Commit();
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "单据号:" + HBillNo + " åˆ é™¤æˆåŠŸ";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                catch (Exception e)
                {
                    oCn.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除条码出入库缓存列表单据失败!" + e.ToString();
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除条码出入库缓存列表单据失败!" + e.ToString();
                objJsonResult.Message = "获取系统参数失败! " + sErrMsg;
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -3871,19 +4092,62 @@
        #endregion
        #region ç”Ÿäº§ç»„托单    ä¸Šä¼ ç”Ÿå•
        #region é”€å”®é€€è´§    ä¸Šä¼ ç”Ÿå•
        #region é”€å”®é€€è´§    æ–°å¢žæ¨¡å¼
        /// <summary>
        /// ä¸Šä¼ ç”Ÿæˆç”Ÿäº§ç»„托单
        /// é”€å”®é€€è´§æ–°å¢žä¸Šä¼ 
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_SavePackUnionBill_Json")]
        [HttpGet]
        public object set_SavePackUnionBill_Json(Int64 HInterID, string HBillType, string HBillNo, string HBarCode_Pack, string HMaker, Int64 HStockOrgID)
        [Route("WEBSController/set_SaveSellOutBackBill_Json")]
        [HttpPost]
        public object set_SaveSellOutBackBill_Json([FromBody] JObject oMain)
        {
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            try
            {
                if (oWebs.set_SavePackUnionBill_Add(HInterID, HBillType, HBillNo, HBarCode_Pack, HMaker, HStockOrgID, ref DBUtility.ClsPub.sErrInfo))
                List<Model.ClsKf_ICStockBillMain> lsmain = new List<Model.ClsKf_ICStockBillMain>();
                ListModels oListModels = new ListModels();
                lsmain = oListModels.getICStockBillMainByJson(msg1);
                WebS.ClsKf_ICStockBillMain websLsmain = new WebS.ClsKf_ICStockBillMain();
                string sSourceType = lsmain[0].HMainSourceBillType;
                websLsmain.HInterID = lsmain[0].HInterID;
                websLsmain.HBillNo = lsmain[0].HBillNo;
                websLsmain.HBillType = lsmain[0].HBillType;
                websLsmain.HDate = lsmain[0].HDate;
                websLsmain.HDeptID = lsmain[0].HDeptID;
                websLsmain.HWHID = lsmain[0].HWHID;
                websLsmain.HSCWHID = lsmain[0].HSCWHID;
                websLsmain.HSupID = lsmain[0].HSupID;
                websLsmain.HKeeperID = lsmain[0].HKeeperID;
                websLsmain.HSecManagerID = lsmain[0].HSecManagerID;
                websLsmain.HEmpID = lsmain[0].HEmpID;
                websLsmain.HManagerID = lsmain[0].HManagerID;
                websLsmain.HRemark = lsmain[0].HRemark;
                websLsmain.HExplanation = lsmain[0].HExplanation;
                websLsmain.HInnerBillNo = lsmain[0].HInnerBillNo;
                websLsmain.HRedBlueFlag = lsmain[0].HRedBlueFlag;
                websLsmain.HBillSubType = lsmain[0].HBillSubType;
                if (lsmain[0].HMainSourceBillType == "1403")
                {
                    websLsmain.HMainSourceBillType = "退货通知单";
                }
                else if (lsmain[0].HMainSourceBillType == "1401")
                {
                    websLsmain.HMainSourceBillType = "销售订单";
                }
                else
                {
                    websLsmain.HMainSourceBillType = "手工录入";
                }
                websLsmain.HMaker = lsmain[0].HMaker;
                websLsmain.HBillerID = lsmain[0].HBillerID;
                websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
                websLsmain.HOWNERID = lsmain[0].HSTOCKORGID;
                if (oWebs.set_SaveSellOutBackBill_New(websLsmain, sSourceType, ref DBUtility.ClsPub.sErrInfo))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
@@ -3904,7 +4168,50 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "生成生产组托单失败!" + e.ToString();
                objJsonResult.Message = "销售退货单上传失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
        #region ç”Ÿäº§ç»„托单    ä¸Šä¼ ç”Ÿå•
        /// <summary>
        /// ä¸Šä¼ ç”Ÿæˆç”Ÿäº§ç»„托单
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_SavePackUnionBill_Json")]
        [HttpGet]
        public object set_SavePackUnionBill_Json(Int64 HInterID, string HBillType, string HBillNo, string HBarCode_Pack, string HMaker, Int64 HStockOrgID)
        {
            try
            {
                if (oWebs.set_SavePackUnionBill_Add(HInterID, HBillType, HBillNo, HBarCode_Pack, HMaker, HStockOrgID, ref DBUtility.ClsPub.sErrInfo))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "单据号:" + HBillNo + " ä¿å­˜æˆåŠŸï¼";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //失败!
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "生成单据失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -4053,6 +4360,316 @@
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "上料防错单上传失败!" + e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region è½¦é—´ä¸Šæž¶å•    ä¸Šä¼ ç”Ÿå•
        /// <summary>
        /// è½¦é—´ä¸Šæž¶å•新增上传
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_SaveMaterialUpperBill_Json")]
        [HttpPost]
        public object set_SaveMaterialUpperBill_Json([FromBody] JObject oMain)
        {
            BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            try
            {
                string sMainStr = "[" + msg1.ToString() + "]";
                List<Model.ClsKf_WorkShopICStockBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsKf_WorkShopICStockBillMain>>(sMainStr);
                //单据号是否重复
                if (oBaseBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, mainList[0].HBillNo, BillStatus, mainList[0].HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据号重复!不允许保存!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //判断会计期是否合理
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(mainList[0].HDate, ref sYear, ref sPeriod, ref s) == false)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = s;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCn.BeginTran();
                //生成单据
                //插入主表
                oCn.RunProc("Insert Into Kf_WorkShopICStockBillMain   " +
                "(HInterID,HBillNo,HBillType,HBillSubType,HDate,HRemark" +
                ",HYear,HPeriod,HMaker,HMakeDate,HStockOrgID" +
                ",HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo" +
                ",HMangerID,HSecManagerID,HKeeperID,HDeptID" +
                ") " +
                " values(" + mainList[0].HInterID.ToString() + ",'" + mainList[0].HBillNo + "','" + mainList[0].HBillType + "','" + mainList[0].HBillSubType + "','" + mainList[0].HDate.ToShortDateString() + "','" + mainList[0].HRemark + "'" +
                ", " + sYear.ToString() + "," + sPeriod.ToString() + ",'" + mainList[0].HMaker + "',getdate()," + mainList[0].HSTOCKORGID.ToString() +
                ",'" + mainList[0].HMainSourceBillType + "'," + mainList[0].HMainSourceInterID.ToString() + "," + mainList[0].HMainSourceEntryID.ToString() + ",'" + mainList[0].HMainSourceBillNo + "'" +
                ", " + mainList[0].HMangerID.ToString() + "," + mainList[0].HSecManagerID.ToString() + "," + mainList[0].HKeeperID.ToString() + "," + mainList[0].HDeptID.ToString() +
                ") ");
                //插入子表
                ds = oCn.RunProcReturn("exec h_p_Kf_MaterialUpperBillSub_Insert " + mainList[0].HInterID.ToString() + ",'" + mainList[0].HBillNo + "'", "h_p_Kf_MaterialUpperBillSub_Insert");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    oCn.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据保存失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["s"]) != "OK")
                {
                    oCn.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["s"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    //更新车间物料库存
                    oCn.RunProc("EXEC h_p_WMS_UPDateICinventory_WorkShop " + mainList[0].HInterID.ToString() + ",'" + mainList[0].HBillType + "'");
                    //更新车间条码库存
                    oCn.RunProc("EXEC h_p_WMS_UPDateBarCodeICinventory_WorkShop " + mainList[0].HInterID.ToString() + ",'" + mainList[0].HBillType + "',1");
                    oCn.Commit();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "单据号:" + mainList[0].HBillNo + " æ–°å¢žæˆåŠŸï¼";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "车间上架单上传失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region è½¦é—´ä¸‹æž¶å•    ä¸Šä¼ ç”Ÿå•
        /// <summary>
        /// è½¦é—´ä¸‹æž¶å•新增上传
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_SaveMaterialLowerBill_Json")]
        [HttpPost]
        public object set_SaveMaterialLowerBill_Json([FromBody] JObject oMain)
        {
            BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            try
            {
                string sMainStr = "[" + msg1.ToString() + "]";
                List<Model.ClsKf_WorkShopICStockBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsKf_WorkShopICStockBillMain>>(sMainStr);
                //单据号是否重复
                if (oBaseBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, mainList[0].HBillNo, BillStatus, mainList[0].HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据号重复!不允许保存!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //判断会计期是否合理
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(mainList[0].HDate, ref sYear, ref sPeriod, ref s) == false)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = s;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCn.BeginTran();
                //生成单据
                //插入主表
                oCn.RunProc("Insert Into Kf_WorkShopICStockBillMain   " +
                "(HInterID,HBillNo,HBillType,HBillSubType,HDate,HRemark" +
                ",HYear,HPeriod,HMaker,HMakeDate,HStockOrgID" +
                ",HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo" +
                ",HMangerID,HSecManagerID,HKeeperID,HDeptID" +
                ") " +
                " values(" + mainList[0].HInterID.ToString() + ",'" + mainList[0].HBillNo + "','" + mainList[0].HBillType + "','" + mainList[0].HBillSubType + "','" + mainList[0].HDate.ToShortDateString() + "','" + mainList[0].HRemark + "'" +
                ", " + sYear.ToString() + "," + sPeriod.ToString() + ",'" + mainList[0].HMaker + "',getdate()," + mainList[0].HSTOCKORGID.ToString() +
                ",'" + mainList[0].HMainSourceBillType + "'," + mainList[0].HMainSourceInterID.ToString() + "," + mainList[0].HMainSourceEntryID.ToString() + ",'" + mainList[0].HMainSourceBillNo + "'" +
                ", " + mainList[0].HMangerID.ToString() + "," + mainList[0].HSecManagerID.ToString() + "," + mainList[0].HKeeperID.ToString() + "," + mainList[0].HDeptID.ToString() +
                ") ");
                //插入子表
                ds = oCn.RunProcReturn("exec h_p_Kf_MaterialLowerBillSub_Insert " + mainList[0].HInterID.ToString() + ",'" + mainList[0].HBillNo + "'", "h_p_Kf_MaterialLowerBillSub_Insert");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    oCn.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据保存失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["s"]) != "OK")
                {
                    oCn.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["s"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    //更新车间物料库存
                    oCn.RunProc("EXEC h_p_WMS_UPDateICinventory_WorkShop " + mainList[0].HInterID.ToString() + ",'" + mainList[0].HBillType + "'");
                    //更新车间条码库存
                    oCn.RunProc("EXEC h_p_WMS_UPDateBarCodeICinventory_WorkShop " + mainList[0].HInterID.ToString() + ",'" + mainList[0].HBillType + "',-1");
                    oCn.Commit();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "单据号:" + mainList[0].HBillNo + " æ–°å¢žæˆåŠŸï¼";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "车间下架单上传失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å°è½¦é”å®šå•    ä¸Šä¼ ç”Ÿå•
        /// <summary>
        /// å°è½¦é”å®šå•新增上传
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_SaveTrolleyPositionBill_Json")]
        [HttpPost]
        public object set_SaveTrolleyPositionBill_Json([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            string UserName = sArray[2].ToString();
            string OperationType = sArray[3].ToString();
            DBUtility.ClsPub.CurUserName = UserName;
            ListModels oListModels = new ListModels();
            try
            {
                DAL.ClsKf_TrolleyPositionBill oBill = new DAL.ClsKf_TrolleyPositionBill();
                List<Model.ClsKf_TrolleyPositionBillMain> lsmain = new List<Model.ClsKf_TrolleyPositionBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Kf_TrolleyPositionBillMain(msg2);
                foreach (Model.ClsKf_TrolleyPositionBillMain oItem in lsmain)
                {
                    DBUtility.ClsPub.CurUserName = oItem.HMaker;
                    oItem.HBillType = "10004";
                    oItem.HBillSubType = "10004";
                    oItem.HBillStatus = 1;   //单据状态(1未审,2审核通过,3关闭,4作废,5审核退回,6审核中,7已阅,8已回复,9结案,10验证,11下达,12开工,13申请审批,15申请检验,16 åˆ¤å®šåˆæ ¼ï¼Œ17判定不合格)
                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!没有单据日期,无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    oBill.omodel = oItem;
                }
                // è¡¨ä½“数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                List<Model.ClsKf_TrolleyPositionBillSub> ls = new List<Model.ClsKf_TrolleyPositionBillSub>();
                ls = oListModels.getObjectByJson_Kf_TrolleyPositionBillSub(msg3);
                int i = 0;
                foreach (Model.ClsKf_TrolleyPositionBillSub oItemSub in ls)
                {
                    i++;
                    oItemSub.HEntryID = i;
                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    oItemSub.HCloseType = false;   //关闭类型
                    oBill.DetailColl.Add(oItemSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (OperationType == "1")
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                    objJsonResult.Verify = "N";
                }
                if (bResult)
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "小车锁定单上传失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -4549,6 +5166,44 @@
            }
        }
        /// <summary>
        /// å¤å®ä¸“用调拨    æ‰«ææºå•条码    20250513
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/get_SourceBarCode_MoveStock_XiaBao_Json")]
        [HttpGet]
        public object get_SourceBarCode_MoveStock_XiaBao_Json(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HFIFOWhID, Int64 HOWNERID)
        {
            try
            {
                WebSoBar = oWebs.get_SourceBarCode_MoveStock_XiaBao(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HFIFOWhID, HOWNERID, ref DBUtility.ClsPub.sErrInfo);
                if (WebSoBar == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功";
                    objJsonResult.data = WebSoBar;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "扫描源单条码失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region åˆ†æ­¥å¼è°ƒå‡º    æ‰«ææºå•条码
@@ -4690,6 +5345,48 @@
            try
            {
                WebSoBar = oWebs.get_SourceBarCode_MateOutBack(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, ref DBUtility.ClsPub.sErrInfo);
                if (WebSoBar == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功";
                    objJsonResult.data = WebSoBar;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "扫描源单条码失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é”€å”®é€€è´§    æ‰«ææºå•条码
        /// <summary>
        /// é”€å”®é€€è´§    æ‰«ææºå•条码
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Get_SourceBarCode_SellOutBack_Json")]
        [HttpGet]
        public object Get_SourceBarCode_SellOutBack_Json(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HStockOrgID)
        {
            try
            {
                WebSoBar = oWebs.get_SourceBarCode_SellOutBack(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, ref DBUtility.ClsPub.sErrInfo);
                if (WebSoBar == null)
                {
                    objJsonResult.code = "0";
@@ -4954,6 +5651,44 @@
            //    objJsonResult.data = null;
            //    return objJsonResult;
            //}
        }
        /// <summary>
        /// ç‰©æ–™æ¡ç æ–‡æœ¬æ¡† è°ƒæ‹¨æ‰«ç è°ƒç”¨  å¤å®  æ‰«æç‰©æ–™æ¡ç è‡ªåŠ¨å¸¦å‡ºæºå•ä¿¡æ¯    20250506
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/get_BarCode_MoveStock_AddSource_Json")]
        [HttpGet]
        public Object get_BarCode_MoveStock_AddSource_Json(string sBarCode, Int64 HInterID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWHID, Int64 HSCSPID, Double HQty, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HStockInOrgID, Int64 HStockOutOrgID, string HScanStyle, string HCustom1, string HCustom2)
        {
            try
            {
                WebSoBar = oWebs.get_BarCode_MoveStock_AddSource(sBarCode, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillNo, HSourceBillType, HStockInOrgID, HStockOutOrgID, HScanStyle, ref DBUtility.ClsPub.sErrInfo, HCustom1, HCustom2);
                if (WebSoBar == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功";
                    objJsonResult.data = WebSoBar;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "扫描条码失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
@@ -5344,6 +6079,7 @@
            string sJXCode = "";
            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
            {
                string sAutoBarCode = "N";        //免扫物料条码模式('Y'为不扫物料条码)
                string sSourceBarCodeCtl = "N";   //校验-是否进行源单对应条码核对('Y'为核对)
                #region ç³»ç»Ÿå‚数获取
@@ -5351,90 +6087,140 @@
                if (HBillType == "1201")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
                }
                //生产入库单
                if (HBillType == "1202")
                else if (HBillType == "1202")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
                }
                //其他入库单
                if (HBillType == "1203")
                else if (HBillType == "1203")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
                }
                //领料出库单
                else if (HBillType == "1204")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
                }
                //销售出库单
                else if (HBillType == "1205")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
                }
                //其他出库单
                else if (HBillType == "1206")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
                }
                //委外领料单
                else if (HBillType == "1211")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
                }
                //生产补料单
                else if (HBillType == "1254")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
                }
                //委外补料单
                else if (HBillType == "1255")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
                }
                //直接调拨单
                else if (HBillType == "1207")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
                }
                #endregion
@@ -5449,8 +6235,17 @@
                }
                try
                {
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (sAutoBarCode == "Y")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "免扫物料条码模式,无需扫描物料条码!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //原单据为扫码生成,校验时不生成条码记录,只对原扫描的条码进行核对
                    if (sSourceBarCodeCtl == "Y")
                    else if (sSourceBarCodeCtl == "Y")
                    {
                        WebSoBar = oWebs.get_BillBarCode_Verify(HBillID, HBillNo, HBillType, sJXCode, HQty, HMaker, HStockOrgID, ref DBUtility.ClsPub.sErrInfo);
                        if (WebSoBar == null)
@@ -5688,7 +6483,7 @@
            if (oSystemParameter.ShowBillByOrgID(HStockOrgID,ref sErrMsg) == true)
            {
                string sSourceBarCodeCtl = "N";   //校验-是否进行源单对应条码核对('Y'为核对)
                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                {
                    //销售出库单
                    sSourceBarCodeCtl = "Y";
@@ -5811,25 +6606,25 @@
                if (HBillType == "1201")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //生产入库单
                if (HBillType == "1202")
                else if (HBillType == "1202")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //其他入库单
                if (HBillType == "1203")
                else if (HBillType == "1203")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -5838,7 +6633,7 @@
                else if (HBillType == "1204")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -5847,7 +6642,7 @@
                else if (HBillType == "1205")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -5856,7 +6651,7 @@
                else if (HBillType == "1206")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -5865,7 +6660,7 @@
                else if (HBillType == "1211")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -5874,7 +6669,7 @@
                else if (HBillType == "1254")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -5883,7 +6678,7 @@
                else if (HBillType == "1255")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -5892,7 +6687,7 @@
                else if (HBillType == "1207")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -5983,7 +6778,7 @@
            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
            {
                string sSourceBarCodeCtl = "N";   //校验-是否进行源单对应条码核对('Y'为核对)
                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                {
                    //销售出库单
                    sSourceBarCodeCtl = "Y";
@@ -6119,25 +6914,25 @@
                if (HBillType == "1201")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //生产入库单
                if (HBillType == "1202")
                else if (HBillType == "1202")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //其他入库单
                if (HBillType == "1203")
                else if (HBillType == "1203")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -6146,7 +6941,7 @@
                else if (HBillType == "1204")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -6155,7 +6950,7 @@
                else if (HBillType == "1205")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -6164,7 +6959,7 @@
                else if (HBillType == "1206")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -6173,7 +6968,7 @@
                else if (HBillType == "1211")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -6182,7 +6977,7 @@
                else if (HBillType == "1254")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -6191,7 +6986,7 @@
                else if (HBillType == "1255")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -6200,7 +6995,7 @@
                else if (HBillType == "1207")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl == "Y")
                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -6280,7 +7075,7 @@
            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
            {
                string sSourceBarCodeCtl = "N";   //校验-是否进行源单对应条码核对('Y'为核对)
                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                {
                    //销售出库单
                    sSourceBarCodeCtl = "Y";
@@ -6387,6 +7182,56 @@
        #endregion
        #region ç”Ÿäº§ç»„托单模块 æ‰«æç®±ï¼ˆæ‰˜ï¼‰æ¡ç     20250630
        /// <summary>
        /// ç”Ÿäº§ç»„托单模块 æ‰«æç®±ï¼ˆæ‰˜ï¼‰æ¡ç 
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Get_PackBarCode_PackUnionBill_New_Json")]
        [HttpGet]
        public object get_PackBarCode_PackUnionBill_New_Json(Int64 HInterID, string HBillNo, string HBillType, string HBillSubType, string HBarCode_Pack)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_WMS_AddPackBarCode_PackUnionBill_New " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBillSubType + "','" + HBarCode_Pack + "'", "h_p_WMS_AddPackBarCode_PackUnionBill_New");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "扫描托条码发生错误!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "扫描托条码失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç”Ÿäº§ç»„托单模块 æ‰«ææ‰˜æ¡ç å¯¹åº”单个条码
        /// <summary>
@@ -6421,6 +7266,76 @@
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "扫描条码失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç”Ÿäº§ç»„托单模块 æ‰«ææ‰˜æ¡ç å¯¹åº”条码    20250630
        /// <summary>
        /// ç”Ÿäº§ç»„托单模块 æ‰«ææ‰˜æ¡ç å¯¹åº”条码
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Get_BarCode_PackUnionBill_New_Json")]
        [HttpGet]
        public object get_BarCode_PackUnionBill_New_Json(string HBarCode, Int64 HInterID, string HBillNo, string HBillType, string HBillSubType, string HBarCode_Pack, string HMaterNumber_Pack, string HMaker, Int64 HStockOrgID)
        {
            //获取系统参数
            string sErrMsg = "";
            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
            {
                string sMaterialCtl = "Y";          //组托时托条码对应物料与需要组托的条码对应物料要一致(Y为需一致)
                string sSourceBillTypeCtl = "Y";    //未入库条码进行组托时,进行同源单类型控制(Y为控制)
                string sSourceBillNoCtl = "Y";      //未入库条码进行组托时,进行同源单控制(Y为控制)
                sMaterialCtl = oSystemParameter.omodel.Sc_PackUnionBill_MaterialCtl.ToUpper();
                sSourceBillTypeCtl = oSystemParameter.omodel.Sc_PackUnionBill_SourceBillTypeCtl.ToUpper();
                sSourceBillNoCtl = oSystemParameter.omodel.Sc_PackUnionBill_SourceBillNoCtl.ToUpper();
                try
                {
                    ds = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_PackUnionBill_New '" + HBarCode + "'," + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBillSubType + "','" + HBarCode_Pack + "','" + HMaterNumber_Pack + "','" + sMaterialCtl + "','" + sSourceBillTypeCtl + "','" + sSourceBillNoCtl + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_WMS_AddBarCode_PackUnionBill_New");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "扫描条码发生错误!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "成功!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                catch (Exception e)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "扫描条码失败!" + e.ToString();
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "获取系统参数失败! " + sErrMsg;
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -6495,7 +7410,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //成功!
                    objJsonResult.Message = "删除成功";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -6752,6 +7667,102 @@
        //        return objJsonResult;
        //    }
        //}
        #endregion
        #region æ‹†ç®±ï¼ˆæ‹†æ‰˜ï¼‰æ¨¡å— æ‰«ææ‰˜æ¡ç   20250702
        /// <summary>
        ///拆箱(拆托)模块 æ‰«ææ‰˜æ¡ç 
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Get_PackBarCode_UnPackUnionBill_Json")]
        [HttpGet]
        public object Get_PackBarCode_UnPackUnionBill_Json(string HBarCode_Pack, string HBillSubType)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_WMS_AddPackBarCode_UnPackUnionBill_New '" + HBarCode_Pack + "','" + HBillSubType + "'", "h_p_WMS_AddPackBarCode_UnPackUnionBill_New");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "扫描托条码判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0)
                    {
                        List<object> columnNameList = new List<object>();
                        //添加列名
                        foreach (DataColumn col in ds.Tables[0].Columns)
                        {
                            Type dataType = col.DataType;
                            string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                            columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //获取到DataColumn列对象的列名
                        }
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "成功!";
                        objJsonResult.data = ds.Tables[0];
                        objJsonResult.list = columnNameList;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "扫描条码失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "拆箱(拆托)模块,获取箱(托)条码信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region æ‹†ç®±ï¼ˆæ‹†æ‰˜ï¼‰æ¨¡å— ä¸Šä¼  åˆ é™¤ç»„托单信息     20250702
        /// <summary>
        /// ä¸Šä¼   åˆ é™¤ç»„托单信息
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_SaveUnPackUnionBill_Json")]
        [HttpGet]
        public object set_SaveUnPackUnionBill_Json(long HInterID, string HBillNo, string HBarCode_Pack, string HMaker)
        {
            try
            {
                string HIPAddress = "";                         //IP
                string HModCaption = "WMS-拆箱(拆托)模块";    //模块名
                ds = oCn.RunProcReturn("exec h_p_Sc_PackUnionBill_Delete_New " + HInterID.ToString() + ",'" + HBillNo + "','" + HBarCode_Pack + "','" + HMaker + "','" + ComputerName + "','" + HIPAddress + "','" + HModCaption + "'", "h_p_Sc_PackUnionBill_Delete_New");
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "成功";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "拆箱(拆托)失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
@@ -7999,6 +9010,348 @@
        #endregion
        #endregion
        #region ä¸Šæž¶ã€ä¸‹æž¶å•、小车锁定模块调用方法     20250520
        #region ä¸‹æž¶å•扫码模块  æ‰«ææºå•条码调用方法
        /// <summary>
        /// æ‰«ææºå•条码
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Get_SourceBarCode_MaterialLower_Json")]
        [HttpGet]
        public object get_SourceBarCode_MaterialLower_Json(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HStockOrgID)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_MaterialLower " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_WMS_AddSourceBarCode_MaterialLower");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "扫描源单条码,写入源单临时表失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    List<object> columnNameList = new List<object>();
                    //添加列名
                    foreach (DataColumn col in ds.Tables[0].Columns)
                    {
                        Type dataType = col.DataType;
                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //获取到DataColumn列对象的列名
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功!";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "扫描源单条码失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¸Šæž¶ã€ä¸‹æž¶å•扫码模块  æ‰«æç‰©æ–™æ¡ç è°ƒç”¨æ–¹æ³•
        /// <summary>
        /// æ‰«æç‰©æ–™æ¡ç 
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Get_BarCode_WorkShop_Json")]
        [HttpGet]
        public object Get_BarCode_WorkShop_Json(string HBarCode, Int64 HInterID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool SourceFlag, string HSourceBillType, string HCarBarCode, Int64 HStockOrgID)
        {
            //获取系统参数
            string sErrMsg = "";
            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
            {
                string sBatchNoCtl = "N";             //是否进行批号核对('Y'为核对批号)
                string sMustQtyCtl = "小于等于应收";  //应收数量控制(小于等于应收、完全等于应收、不控制)
                //下架单
                if (HBillType == "1252")
                {
                    //是否进行批号核对('Y'为核对批号)
                    if (oSystemParameter.omodel.Kf_MaterialLowerBill_BatchNoCtl.ToUpper() == "Y")
                    {
                        sBatchNoCtl = "Y";
                    }
                    //扫码数量能否可超单据数量控制(小于等于应收、完全等于应收、不控制)
                    if (oSystemParameter.omodel.Kf_MaterialLowerBill_MustQtyCtl == "小于等于应收")
                    {
                        sMustQtyCtl = "小于等于应收";
                    }
                    else if (oSystemParameter.omodel.Kf_MaterialLowerBill_MustQtyCtl == "完全等于应收")
                    {
                        sMustQtyCtl = "完全等于应收";
                    }
                    else
                    {
                        sMustQtyCtl = "不控制";
                    }
                }
                try
                {
                    ds = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_WorkShop " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "'," + HQty.ToString() + ",'" + HSourceBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HCarBarCode + "'," + HStockOrgID.ToString() + ",'" + HMaker + "'," + DBUtility.ClsPub.BoolToString(SourceFlag) + ",'" + sBatchNoCtl + "','" + sMustQtyCtl + "'", "h_p_WMS_AddBarCode_WorkShop");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "扫描物料条码,写入临时表失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "成功!";
                        objJsonResult.data = ds.Tables[0];
                        return objJsonResult;
                    }
                }
                catch (Exception e)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "扫描物料条码失败!" + e.ToString();
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "获取系统参数失败! " + sErrMsg;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
        #endregion
        #region è½¦é—´ç‰©æ–™åº“存查询调用方法
        /// <summary>
        /// èŽ·å–è½¦é—´ç‰©æ–™æ‰€åœ¨ä½ç½®
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/GetICInventory_WorkShop_Json")]
        [HttpGet]
        public object GetICInventory_WorkShop_Json(string HBillType, Int64 HMaterID, Int64 HAuxPropID, string HBatchNo, Int64 HProcessExchangeInterID)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_KF_ICInventory_WorkShop '" + HBillType + "'," + HMaterID.ToString() + "," + HAuxPropID.ToString() + ",'" + HBatchNo + "'," + HProcessExchangeInterID.ToString(), "h_p_KF_ICInventory_WorkShop");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有返回任何结果!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    List<object> columnNameList = new List<object>();
                    //添加列名
                    foreach (DataColumn col in ds.Tables[0].Columns)
                    {
                        Type dataType = col.DataType;
                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //获取到DataColumn列对象的列名
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功!";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询车间物料库存失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¸‹æž¶å•模块,扫源单条码查询物料库存信息
        /// <summary>
        /// èŽ·å–å•æ®åˆ—è¡¨ä¿¡æ¯
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/MaterialLowerBill_MaterInv")]
        [HttpGet]
        public object MaterialLowerBill_MaterInv(long HInterID, string HBillNo, string HBillType, Int64 HStockOrgID)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_Kf_MaterialInventory " + HInterID + "," + HBillType + "," + HStockOrgID, "h_p_Kf_MaterialInventory");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有返回任何记录!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    List<object> columnNameList = new List<object>();
                    //添加列名
                    foreach (DataColumn col in ds.Tables[0].Columns)
                    {
                        Type dataType = col.DataType;
                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //获取到DataColumn列对象的列名
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "获取信息成功!";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "获取列表信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å°è½¦æ‰«ç ç»‘定时,判断其是否已绑定库位信息
        [Route("WEBSController/CarIsused")]
        [HttpGet]
        public object CarIsused(string HCarBarCode)
        {
            try
            {
                ds = oCn.RunProcReturn("select * from h_v_Gy_MouldIsUsed where å°è½¦æ¡ç ='" + HCarBarCode + "'" , "h_v_Gy_MouldIsUsed");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "小车条码:" + HCarBarCode + ",不在系统中,请核对!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    List<object> columnNameList = new List<object>();
                    //添加列名
                    foreach (DataColumn col in ds.Tables[0].Columns)
                    {
                        Type dataType = col.DataType;
                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //获取到DataColumn列对象的列名
                    }
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功!";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询小车在库状态失败err!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å°è½¦ç»‘定机台时,判断所扫机台(设备)条码是否存在于设备档案
        [Route("WEBSController/IsExistEquip")]
        [HttpGet]
        public object IsExistEquip(string HEquipBarCode)
        {
            try
            {
                ds = oCn.RunProcReturn("select * from h_v_Gy_EquipIsExist where æœºå°æ¡ç ='" + HEquipBarCode + "'", "h_v_Gy_EquipIsExist");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "机台条码:" + HEquipBarCode + ",不在系统中,请核对!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    List<object> columnNameList = new List<object>();
                    //添加列名
                    foreach (DataColumn col in ds.Tables[0].Columns)
                    {
                        Type dataType = col.DataType;
                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //获取到DataColumn列对象的列名
                    }
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功!";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询机台信息失败err!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
        #region ç‰©æ–™æ¡ç æŸ¥è¯¢è°ƒç”¨æ–¹æ³•
@@ -10360,7 +11713,7 @@
                    HSourceBillNo_TB = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSourceBillNo"]);
                    HSourceInterID = DBUtility.ClsPub.isInt(ds.Tables[0].Rows[0]["HSourceInterID"]);
                    //根据入库申请单单号判断单据信息是否已经同步到金蝶
                    sql = string.Format(@"select FID,FBILLNO from {0}..TFKO_t_Cust100009 with(nolock) where FBILLNO = '" + HSourceBillNo_TB + "'", HDataBaseName);
                    sql = string.Format(@"select FID,FBILLNO,FDOCUMENTSTATUS from {0}..TFKO_t_Cust100009 with(nolock) where FBILLNO = '" + HSourceBillNo_TB + "'", HDataBaseName);
                    ds = oCn.RunProcReturn(sql, "TFKO_t_Cust100009");
                    //入库申请单没有同步到金蝶则进行同步
@@ -10506,10 +11859,7 @@
                                LogService.Write("发生异常,入库申请单同步获取登录账号密码失败!:" + sBarCode + "," + HSourceBillNo_TB + "," + HSourceInterID);
                                return "发生异常,入库申请单同步获取登录账号密码失败!";
                            }
                            LogService.Write("其他入库,即将登录金蝶");
                            var loginRet = InvokeHelper.Login();
                            LogService.Write("其他入库,登录金蝶结果1:" + loginRet);
                            LogService.Write("其他入库,登录金蝶结果2:" + JObject.Parse(loginRet)["LoginResultType"].Value<int>());
                            var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
                            if (isSuccess == 0)
@@ -10541,7 +11891,7 @@
                                string sJXCode = "";
                                if (oSystemParameter.ShowBill(ref sErrMsg) == true)
                                {
                                    if (oSystemParameter.omodel.Kf_StockInRequestBill_AutoCheck == "Y") //系统参数  è‡ªåŠ¨å®¡æ ¸
                                    if (oSystemParameter.omodel.Kf_StockInRequestBill_AutoCheck.ToUpper() == "Y") //系统参数  è‡ªåŠ¨å®¡æ ¸
                                    {
                                        result1 = InvokeHelper.Submit("k18d2ab4f14034c569576ec8e0835a80c", JsonConvert.SerializeObject(json));//提交
                                        result2 = InvokeHelper.Audit("k18d2ab4f14034c569576ec8e0835a80c", JsonConvert.SerializeObject(json));//审核
@@ -10563,11 +11913,88 @@
                        }
                        //更新条码源单id信息
                        sql = string.Format($@"update a set HSourceInterID = isnull(b.FID,0),HSourceEntryID = isnull(c.FEntryID,0) from Gy_BarCodeBill a left join AIS20220609121235..TFKO_t_Cust100009 b on a.HSourceBillNo = b.FBillNo left join AIS20220609121235..TFKO_t_Cust_Entry100065 c on b.FID = C.FID and a.HBarcodeNo = c.FSEQ where HSourceBillNo = '{HSourceBillNo_TB}'");
                        sql = string.Format($@"update a set HSourceInterID = isnull(b.FID,0),HSourceEntryID = isnull(c.FEntryID,0) from Gy_BarCodeBill a with(nolock) left join AIS20220609121235..TFKO_t_Cust100009 b with(nolock) on a.HSourceBillNo = b.FBillNo left join AIS20220609121235..TFKO_t_Cust_Entry100065 c with(nolock) on b.FID = C.FID and a.HBarcodeNo = c.FSEQ where HSourceBillNo = '{HSourceBillNo_TB}'");
                        //执行更新语句
                        oCn.RunProc(sql);
                    }
                    //判断生产入库申请单是否是审核状态,若未审核则执行提交审核方法
                    else
                    {
                        //--Z æš‚存,A åˆ›å»ºï¼ŒB å®¡æ ¸ä¸­ï¼ŒC å·²å®¡æ ¸ï¼ŒD é‡æ–°å®¡æ ¸
                        //获取入库申请单单据号
                        string HBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["FBILLNO"]);
                        //包装线生成的生产入库申请单参与自动审核
                        if (HBillNo.Substring(0,2) == "RK" )
                        {
                            //获取入库申请单单据状态
                            string HBillStatus = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["FDOCUMENTSTATUS"]);
                            //获取入库申请单ID
                            var json = new
                            {
                                Ids = ds.Tables[0].Rows[0]["FID"].ToString(),
                            };
                            LogService.Write("提交审核ID:" + DBUtility.ClsPub.isInt(ds.Tables[0].Rows[0]["FID"]));
                            //从配置文件获取 CLOUD网址、账套信息、登录用户、登录密码
                            if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
                            {
                                LogService.Write("发生异常,入库申请单同步获取登录账号密码失败!:" + sBarCode + "," + HSourceBillNo_TB + "," + HSourceInterID);
                                return "发生异常,入库申请单同步获取登录账号密码失败!";
                            }
                            //登录金蝶
                            var loginRet = InvokeHelper.Login();
                            //判断是否登录成功
                            var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
                            if (isSuccess == 0)
                            {
                                LogService.Write("其他入库,登录金蝶失败!" + sBarCode + "," + HSourceBillNo_TB + "," + HSourceInterID);
                                return "发生异常,登录金蝶失败!";
                            }
                            //提交审核
                            string result1 = string.Empty;
                            string result2 = string.Empty;
                            //创建,重新审核状态调用提交,审核按钮
                            if (HBillStatus == "A" || HBillStatus == "D")
                            {
                                LogService.Write("生产入库申请单号:" + HBillNo + ",重新进行提交审核");
                                result1 = InvokeHelper.Submit("k18d2ab4f14034c569576ec8e0835a80c", JsonConvert.SerializeObject(json));//提交
                                result2 = InvokeHelper.Audit("k18d2ab4f14034c569576ec8e0835a80c", JsonConvert.SerializeObject(json));//审核
                                if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                                {
                                    LogService.Write("入库申请单单号:" + ",提交失败" + result1);
                                    return "发生异常,入库申请单单号:" + ",提交失败" + result1;
                                }
                                if (JObject.Parse(result2)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                                {
                                    LogService.Write("入库申请单单号:" + ",审核失败" + result2);
                                    return "发生异常,入库申请单单号:" + ",审核失败" + result2;
                                }
                            }
                            //审核中状态调用审核按钮
                            else if (HBillStatus == "B")
                            {
                                LogService.Write("生产入库申请单号:" + HBillNo + ",重新进行审核");
                                result2 = InvokeHelper.Audit("k18d2ab4f14034c569576ec8e0835a80c", JsonConvert.SerializeObject(json));//审核
                                if (JObject.Parse(result2)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                                {
                                    LogService.Write("入库申请单单号:" + ",审核失败" + result2);
                                    return "发生异常,入库申请单单号:" + ",审核失败" + result2;
                                }
                            }
                            //更新条码源单id信息
                            sql = string.Format($@"update a set HSourceInterID = isnull(b.FID,0),HSourceEntryID = isnull(c.FEntryID,0) from Gy_BarCodeBill a with(nolock) left join AIS20220609121235..TFKO_t_Cust100009 b with(nolock) on a.HSourceBillNo = b.FBillNo left join AIS20220609121235..TFKO_t_Cust_Entry100065 c with(nolock) on b.FID = C.FID and a.HBarcodeNo = c.FSEQ where HSourceBillNo = '{HSourceBillNo_TB}'");
                            //执行更新语句
                            oCn.RunProc(sql);
                        }
                    }
                }
                HReturnResult = sBarCode;