yxj
2025-11-07 aefdf847ad509b52fe46ed58158e75ca66545d09
WebAPI/Controllers/ÌõÂë¹ÜÀí/WEBSController.cs
@@ -1410,6 +1410,50 @@
        #endregion
        #region æ‰«ç æ¨¡å—    æ‰«ææºå• è¿›è¡ŒæŽ§åˆ¶åˆ¤æ–­
        /// <summary>
        /// æºå•列表信息,根据单据类型、源单类型、组织ID返回源单列表信息
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/GetSourceBillList_Control")]
        [HttpGet]
        public object GetSourceBillList_Control(string HBillType, string HSourceBillType, Int64 HStockOrgID, string HSourceBillNo, string HMater, string HCustom)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_WMS_GetSourceBillList_Control '" + HBillType + "','" + HSourceBillType + "'," + HStockOrgID.ToString() + ",'" + HSourceBillNo + "','" + HMater + "','" + HCustom + "'", "h_p_WMS_GetSourceBillList_Control");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "判断源单失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if(DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                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
        #region æ‰«ç æ¨¡å—    è¿”回源单列表信息
        /// <summary>
@@ -2122,50 +2166,73 @@
        [HttpGet]
        public object set_DeleteICStockBillAndWMS_Json(Int64 HInterID, string HBillNo, string HBillType, string HMaker, string MvarReportTitle)
        {
            try
            //获取系统参数
            string sErrMsg = "";
            if (oSystemParameter.ShowBill(ref sErrMsg) == true)
            {
                string WorkList = "撤销已上传单据,单据号:" + HBillNo;
                string SystemName = "WMS-" + MvarReportTitle + "模块";
                oCn.BeginTran();
                ds = oCn.RunProcReturn("exec h_p_WMS_ICStockBillAndWMS_Delete " + HInterID + ",'" + HBillNo + "','" + HBillType + "'", "h_p_WMS_ICStockBillAndWMS_Delete");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                //撤销前判断金蝶云中单据是否存在
                if (!GetBillQuery_WMS(HInterID, HBillNo, HBillType, HMaker, oSystemParameter.omodel.WMS_CloudMode, oSystemParameter.omodel.WMS_WMSStockCtl_ERPMode, 2, ref sErrMsg))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = sErrMsg;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                try
                {
                    oCn.BeginTran();
                    ds = oCn.RunProcReturn("exec h_p_WMS_ICStockBillAndWMS_Delete " + HInterID + ",'" + HBillNo + "','" + HBillType + "'", "h_p_WMS_ICStockBillAndWMS_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
                    {
                        string WorkList = "撤销已上传单据,单据号:" + HBillNo;
                        string SystemName = "WMS-" + MvarReportTitle + "模块";
                        //写入日志
                        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 = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                catch (Exception e)
                {
                    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 = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                    objJsonResult.Message = "撤销单据已上传记录失败!" + e.ToString();
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            else
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "撤销单据已上传记录失败!" + e.ToString();
                objJsonResult.Message = "获取系统参数失败! " + sErrMsg;
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -2305,10 +2372,18 @@
                    sFIFOCtl = "Y";
                }
                //删除前判断金蝶云中单据是否存在
                if (!GetBillQuery_WMS(HInterID, HBillNo, HBillType, HMaker, oSystemParameter.omodel.WMS_CloudMode, sERPMode, 1, ref sErrMsg))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = sErrMsg;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                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)
@@ -2331,6 +2406,8 @@
                    }
                    else
                    {
                        string WorkList = "删除缓存单据,单据号:" + HBillNo;
                        string SystemName = "WMS-" + MvarReportTitle + "模块";
                        //写入日志
                        oCn.RunProc("Insert into  System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " +
                            "(getdate(),'" + HMaker + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','','删除')"
@@ -2400,6 +2477,210 @@
            }
        }
        #endregion
        #region é‡‘蝶云单据查询
        public bool GetBillQuery_WMS(Int64 HInterID, string HBillNo, string HBillType, string HMaker, string sCloudMode, string sERPMode, Int64 sHType, ref string sErrMsg)
        {
            //sCloudMode:系统参数  æ˜¯å¦ä¸ºç§æœ‰äº‘模式(N为公有云模式,Y为私有云模式);
            //sERPMode:系统参数  åº“存控制-WMS库存控制ERP模式   (WISE、CLOUD、MES);
            //sHType:值 1 å¯¹åº”缓存列表删除;值 2 å¯¹åº”已上传撤销;
            //公有云模式
            if (sCloudMode == "N")
            {
                string sFormId = "";    //业务对象表单Id
                //生产汇报单
                if (HBillType == "3711")
                {
                    sFormId = "PRD_MORPT";
                }
                //采购入库单、委外入库单
                else if (HBillType == "1201" || HBillType == "1210")
                {
                    sFormId = "STK_InStock";
                }
                //生产入库单
                else if (HBillType == "1202")
                {
                    sFormId = "PRD_INSTOCK";
                }
                //其他入库单
                else if (HBillType == "1203")
                {
                    sFormId = "STK_MISCELLANEOUS";
                }
                //领料出库单
                else if (HBillType == "1204")
                {
                    sFormId = "PRD_PickMtrl";
                }
                //销售出库单
                else if (HBillType == "1205")
                {
                    sFormId = "SAL_OUTSTOCK";
                }
                //其他出库单
                else if (HBillType == "1206")
                {
                    sFormId = "STK_MisDelivery";
                }
                //委外出库单
                else if (HBillType == "1211")
                {
                    sFormId = "SUB_PickMtrl";
                }
                //生产补料单
                else if (HBillType == "1254")
                {
                    sFormId = "PRD_FeedMtrl";
                }
                //委外补料单
                else if (HBillType == "1255")
                {
                    sFormId = "SUB_FEEDMTRL";
                }
                //直接调拨单
                else if (HBillType == "1207")
                {
                    sFormId = "STK_TransferDirect";
                }
                //分步式调出单
                else if (HBillType == "1250")
                {
                    sFormId = "STK_TRANSFEROUT";
                }
                //分步式调入单
                else if (HBillType == "1251")
                {
                    sFormId = "STK_TRANSFERIN";
                }
                //采购退料单(采购入库单红字)
                else if (HBillType == "1239")
                {
                    sFormId = "PUR_MRB";
                }
                //生产退库单(产品入库单红字)
                else if (HBillType == "1245")
                {
                    sFormId = "PRD_RetStock";
                }
                //其他入库单(红字)
                else if (HBillType == "1248")
                {
                    sFormId = "";
                }
                //委外退库单(委外入库单红字)
                else if (HBillType == "1246")
                {
                    sFormId = "";
                }
                //生产退料单(生产领料单红字)
                else if (HBillType == "1244")
                {
                    sFormId = "PRD_ReturnMtrl";
                }
                //销售退货单(销售出库单红字)
                else if (HBillType == "1247")
                {
                    sFormId = "SAL_RETURNSTOCK";
                }
                //其他出库单(红字)
                else if (HBillType == "1249")
                {
                    sFormId = "";
                }
                //委外退料单(委外出库单红字)
                else if (HBillType == "1238")
                {
                    sFormId = "SUB_RETURNMTRL";
                }
                //登录金蝶
                var loginRet = InvokeHelper.Login();
                var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
                //判断是否登录成功
                if (isSuccess < 0)
                {
                    sErrMsg = "默认金蝶云账号登录失败!";
                    return false;
                }
                else
                {
                    //单据查询
                    var sJson = new
                    {
                        FormId = sFormId,
                        FieldKeys = "FBillNo",
                        FilterString = $@"FBillNo='{HBillNo}'",
                        OrderString = "",
                        TopRowCount = 0,
                        StartRow = 0,
                        Limit = 0
                    };;
                    var _result = InvokeHelper.Query(sFormId, JsonConvert.SerializeObject(sJson));
                    var _saveObj = JArray.Parse(_result);
                    //判断返回的数组中有无数据,无数据代表没查询到对应单据
                    if (_saveObj.Count == 0)
                    {
                        return true;
                    }
                    else
                    {
                        //sHType = 1对应缓存列表删除
                        if (sHType == 1)
                        {
                            //判断返回的数组数据中是否存在"false",存在代表递入的业务对象表单Id不正确
                            if (_saveObj[0][0].ToString().Contains("false") == true)
                            {
                                return true;
                            }
                            else
                            {
                                sErrMsg = "数据存在异常,不允许删除!单据号:" + HBillNo + " åœ¨é‡‘蝶云中已生成单据,请先在金蝶云里删除该单据,并在缓存列表的已上传界面撤销该单据,再对该单据进行编辑或删除操作!";
                                return false;
                            }
                        }
                        //sHType = 2对应已上传撤销
                        else
                        {
                            //判断返回的数组数据中是否存在"false",存在代表递入的业务对象表单Id不正确
                            if (_saveObj[0][0].ToString().Contains("false") == true)
                            {
                                sErrMsg = "此模块暂不支持撤销功能!";
                                return false;
                            }
                            else
                            {
                                sErrMsg = "撤销单据失败,单据号:" + HBillNo + ",金蝶云里未删除,不允许撤销!";
                                return false;
                            }
                        }
                    }
                }
            }
            //私有云模式
            else
            {
                ds = oCn.RunProcReturn("exec h_p_WMS_BillQuery " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + sERPMode + "'," + sHType.ToString(), "h_p_WMS_BillQuery");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    sErrMsg = "单据查询发生错误!";
                    return false;
                }
                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
                {
                    sErrMsg = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                    return false;
                }
                else
                {
                    return true;
                }
            }
        }
        #endregion
        #endregion
@@ -3880,96 +4161,116 @@
        [HttpPost]
        public object set_SaveMoveStockBill_Json([FromBody] JObject oMain)
        {
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            try
            //获取系统参数
            string sErrMsg = "";
            if (oSystemParameter.ShowBill(ref sErrMsg) == true)
            {
                List<Model.ClsKf_MoveStockBillMain> lsmain = new List<Model.ClsKf_MoveStockBillMain>();
                ListModels oListModels = new ListModels();
                lsmain = oListModels.getMoveStockBillMainByJson(msg1);
                WebS.ClsKf_MoveStockBillMain websLsmain = new WebS.ClsKf_MoveStockBillMain();
                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;
                websLsmain.HStockStyle = lsmain[0].HStockStyle;
                websLsmain.HTransferDirect = lsmain[0].HTransferDirect;
                websLsmain.HShipType = lsmain[0].HShipType;
                if (lsmain[0].HMainSourceBillType == "1402")
                var _value = oMain["oMain"].ToString();
                string msg1 = _value.ToString();
                try
                {
                    websLsmain.HMainSourceBillType = "发货通知单";
                }
                else if (lsmain[0].HMainSourceBillType == "1243")
                {
                    websLsmain.HMainSourceBillType = "调拨申请单";
                }
                else if (lsmain[0].HMainSourceBillType == "3720")
                {
                    websLsmain.HMainSourceBillType = "生产用料清单";
                }
                else if (lsmain[0].HMainSourceBillType == "1604")
                {
                    websLsmain.HMainSourceBillType = "委外用料清单";
                }
                else if (lsmain[0].HMainSourceBillType == "1214")
                {
                    websLsmain.HMainSourceBillType = "生产发料通知单";
                }
                else if (lsmain[0].HMainSourceBillType == "3721")
                {
                    websLsmain.HMainSourceBillType = "生产备料单";
                }
                else if (lsmain[0].HMainSourceBillType == "1242")
                {
                    websLsmain.HMainSourceBillType = "出库申请单";
                }
                else
                {
                    websLsmain.HMainSourceBillType = "手工录入";
                }
                websLsmain.HMaker = lsmain[0].HMaker;
                websLsmain.HBillerID = lsmain[0].HBillerID;
                websLsmain.HStockInOrgID = lsmain[0].HStockInOrgID;
                websLsmain.HStockOutOrgID = lsmain[0].HStockOutOrgID;
                websLsmain.HSTOCKORGID = lsmain[0].HStockOutOrgID;
                websLsmain.HOWNERID = lsmain[0].HStockOutOrgID;
                    List<Model.ClsKf_MoveStockBillMain> lsmain = new List<Model.ClsKf_MoveStockBillMain>();
                    ListModels oListModels = new ListModels();
                    lsmain = oListModels.getMoveStockBillMainByJson(msg1);
                    WebS.ClsKf_MoveStockBillMain websLsmain = new WebS.ClsKf_MoveStockBillMain();
                    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;
                    if (oSystemParameter.omodel.WMS_CampanyName == "小卫") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                    {
                        websLsmain.HSupID = lsmain[0].HCusID;
                    }
                    else
                    {
                        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;
                    websLsmain.HStockStyle = lsmain[0].HStockStyle;
                    websLsmain.HTransferDirect = lsmain[0].HTransferDirect;
                    websLsmain.HShipType = lsmain[0].HShipType;
                    if (lsmain[0].HMainSourceBillType == "1402")
                    {
                        websLsmain.HMainSourceBillType = "发货通知单";
                    }
                    else if (lsmain[0].HMainSourceBillType == "1243")
                    {
                        websLsmain.HMainSourceBillType = "调拨申请单";
                    }
                    else if (lsmain[0].HMainSourceBillType == "3720")
                    {
                        websLsmain.HMainSourceBillType = "生产用料清单";
                    }
                    else if (lsmain[0].HMainSourceBillType == "1604")
                    {
                        websLsmain.HMainSourceBillType = "委外用料清单";
                    }
                    else if (lsmain[0].HMainSourceBillType == "1214")
                    {
                        websLsmain.HMainSourceBillType = "生产发料通知单";
                    }
                    else if (lsmain[0].HMainSourceBillType == "3721")
                    {
                        websLsmain.HMainSourceBillType = "生产备料单";
                    }
                    else if (lsmain[0].HMainSourceBillType == "1242")
                    {
                        websLsmain.HMainSourceBillType = "出库申请单";
                    }
                    else
                    {
                        websLsmain.HMainSourceBillType = "手工录入";
                    }
                    websLsmain.HMaker = lsmain[0].HMaker;
                    websLsmain.HBillerID = lsmain[0].HBillerID;
                    websLsmain.HStockInOrgID = lsmain[0].HStockInOrgID;
                    websLsmain.HStockOutOrgID = lsmain[0].HStockOutOrgID;
                    websLsmain.HSTOCKORGID = lsmain[0].HStockOutOrgID;
                    websLsmain.HOWNERID = lsmain[0].HStockOutOrgID;
                if (oWebs.set_SaveMoveStockBill(websLsmain, sSourceType, ref DBUtility.ClsPub.sErrInfo))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //成功!
                    objJsonResult.data = null;
                    return objJsonResult;
                    if (oWebs.set_SaveMoveStockBill(websLsmain, sSourceType, 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;
                    }
                }
                else
                catch (Exception e)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //失败!
                    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;
            }
@@ -7789,6 +8090,56 @@
        #endregion
        #region ç”Ÿäº§ç»„托单模块 æ‰«æå®¢æˆ·ç®±ï¼ˆæ‰˜ï¼‰æ¡ç  -凯贝装箱单     20251103
        /// <summary>
        /// ç”Ÿäº§ç»„托单模块 æ‰«æç®±ï¼ˆæ‰˜ï¼‰æ¡ç 
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Get_PackBarCode_PackUnionBill_New_Json_Cus")]
        [HttpGet]
        public object Get_PackBarCode_PackUnionBill_New_Json_Cus(Int64 HInterID, string HBillNo, string HBillType, string HBillSubType, string HBarCode_Pack, string HSourceBillNo)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_WMS_AddPackBarCode_PackUnionBill_New_Cus " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBillSubType + "','" + HBarCode_Pack + "','" + HSourceBillNo + "'", "h_p_WMS_AddPackBarCode_PackUnionBill_New_Cus");
                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>
@@ -7854,6 +8205,76 @@
                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;
            }
        }
        #endregion
        #region ç”Ÿäº§ç»„托单模块 æ‰«æå®¢æˆ·æ‰˜æ¡ç å¯¹åº”条码  -凯贝装箱单     20251103
        /// <summary>
        /// ç”Ÿäº§ç»„托单模块 æ‰«ææ‰˜æ¡ç å¯¹åº”条码
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Get_BarCode_PackUnionBill_New_Json_Cus")]
        [HttpGet]
        public object Get_BarCode_PackUnionBill_New_Json_Cus(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_Cus '" + HBarCode + "'," + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBillSubType + "','" + HBarCode_Pack + "','" + HMaterNumber_Pack + "','" + sMaterialCtl + "','" + sSourceBillTypeCtl + "','" + sSourceBillNoCtl + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_WMS_AddBarCode_PackUnionBill_New_Cus");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
@@ -12730,5 +13151,116 @@
            }
        }
       #region æƒ åº· ç”Ÿäº§é¢†æ–™å•校验 æ‰«ææºå• èŽ·å–ç”Ÿäº§é¢†æ–™å•å’Œä¸‹æ¸¸é¢†æ–™å•æœªå®¡æ ¸ å•据
        [Route("WEBSController/get_BillBarCode_BillCheck_Json_MateOut_HuiKang")]
        [HttpGet]
        public Object get_BillBarCode_BillCheck_Json_MateOut_HuiKang(string HBillNo, string HBillType, string HMaker, Int64 HStockOrgID)
        {
            try
            {
                WebSoBar = null;
                // 1. æŸ¥è¯¢é‡‘蝶云中 æ‰€æœ‰ç¬¦åˆçš„生产领料单和下游领料单
                ds = oCn.RunProcReturn($@"
                    select HBillNo, HChecker,HMaker from h_v_Kf_MateOutBillList_K3 where HBillNo like '%{HBillNo}%'
                ", "h_v_Kf_MateOutBillList_K3");
                List<string> HBillNoList = new List<string>();
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    if (string.IsNullOrWhiteSpace(row["HChecker"].ToString())){
                        // 2. åˆ¤æ–­å•据审核状态,查找未被审核的单据
                        WebSoBar = oWebs.get_BillBarCode_BillCheck(row["HBillNo"].ToString(), HBillType, row["HMaker"].ToString(), HStockOrgID, ref DBUtility.ClsPub.sErrInfo);
                        if (WebSoBar != null)
                        {
                            // 3. èŽ·å–åˆ°ç¬¦åˆæ¡ä»¶çš„è¿”å›žå€¼ï¼Œç«‹å³è¿”å›ž
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "成功";
                            objJsonResult.data = WebSoBar;
                            return objJsonResult;
                        }
                    }
                }
                // 3. æ‰€æœ‰å•据都被审核,或者没有符合要求的单据,返回错误信息
                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 å‡¯è´ è£…箱单保存后  è‡ªåŠ¨ç”Ÿæˆäº§é‡æ±‡æŠ¥å•
        [Route("WEBSController/Sc_ICMOBillWorkQtyStatus_Tmp_Save")]
        [HttpGet]
        public object Sc_ICMOBillWorkQtyStatus_Tmp_Save(string HInterID)
        {
            try
            {
                string sql = $"exec [h_p_Sc_ICMOBillWorkQtyStatus_Save] {HInterID}";
                ds = oCn.RunProcReturn(sql, "[h_p_Sc_ICMOBillWorkQtyStatus_Save]");
                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
    }
}