1
zrg
2026-04-16 dab7c538e82f76a92d56af6da56c15c746bd7252
WebAPI/Controllers/ÌõÂë¹ÜÀí/WEBSController.cs
@@ -20,6 +20,7 @@
namespace WebAPI.Controllers
{
    public class WEBSController : ApiController
    {
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
@@ -46,6 +47,7 @@
        /// <returns></returns>
        [Route("WEBSController/GetUser_Json")]
        [HttpGet]
        [AllowAnonymous]
        public object GetUser_Json(string HUserNumber, string HPassWord, Int64 HStockOrgID, string HStockOrgName)
        {
            try
@@ -91,11 +93,23 @@
                        return objJsonResult;
                    }
                    if(!oSystemParameter.ShowBill(ref DBUtility.ClsPub.sErrInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "登录异常!Token ç”Ÿæˆå¼‚常,无法获取公司信息!";
                    }
                    string tokenStr = JWTHelper.GenerateToken(ds.Tables[0].Rows[0]["Czybm"].ToString(), ds.Tables[0].Rows[0]["Czymc"].ToString());
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "登录成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                    JObject jobjJsonResult = JObject.FromObject(objJsonResult);
                    jobjJsonResult["token"] = tokenStr;
                    return jobjJsonResult;
                }
            }
            catch (Exception e)
@@ -1564,6 +1578,84 @@
        #endregion
        #region æ‰«ç æ¨¡å—    æ ¹æ®æ¡ç åˆ é™¤ç¼“存列表中对应条码记录
        /// <summary>
        /// æ ¹æ®æ¡ç æ›´æ–°æ¡ç å‡ºå…¥åº“缓存表数量
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_UpdatePonderationBillMain_Temp_BarCode_Json")]
        [HttpGet]
        public object set_UpdatePonderationBillMain_Temp_BarCode_Json(long HInterID, string HBillType, string HBarCode, double HQty, long HItemID)
        {
            try
            {
                //(HBarCode_Pack <> '' and HInterID = { HInterID.ToString() } and HBillType = '{HBillType}' and HBarCode_Pack = '{HBarCode}') or
                //              (HBarCode <> '' and HInterID ={ HInterID.ToString()}
                //and HBillType = '{HBillType}' and HBarCode = '{HBarCode}')
                // æ ¹æ®æ‰˜æ¡ç å­—段和条码字段 åˆ¤æ–­ æ›´æ–°çš„æ¡ç æ•°é‡æ˜¯å¦å¤§äºŽæœ€å¤§æ•°é‡æˆ–小于0
                ds = oCn.RunProcReturn($@"select * from KF_PonderationBillMain_Temp where
                    HItemID = {HItemID}
                ", "KF_PonderationBillMain_Temp");
                if(ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    // æ‰€æ‰«æ¡ç ä¸å­˜åœ¨
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "更新失败,所扫条码不存在...";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if(HQty < 0)
                {
                    // æ›´æ–°çš„æ¡ç æ•°é‡å°äºŽ0
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "更新失败,更新数量小于0...";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //if(Double.Parse(ds.Tables[0].Rows[0]["HQtyMust"].ToString()) < HQty)
                //{
                    //// æ›´æ–°çš„æ¡ç æ•°é‡æ˜¯å¦å¤§äºŽæœ€å¤§æ•°é‡
                    //objJsonResult.code = "0";
                    //objJsonResult.count = 0;
                    //objJsonResult.Message = $"更新失败,条码数量{HQty}大于最大可扫数量{ds.Tables[0].Rows[0]["HQtyMust"].ToString()}...";
                    //objJsonResult.data = null;
                    //return objJsonResult;
                //}
                //根据托条码字段更新本单条码出入库缓存表数据
                //oCn.RunProc($"Update KF_PonderationBillMain_Temp set HQty = {HQty} where HBarCode_Pack<>'' and HInterID={HInterID.ToString()} and HBillType='{HBillType}' and HBarCode_Pack='{HBarCode}'", ref DBUtility.ClsPub.sExeReturnInfo);
                //根据条码字段更新本单条码出入库缓存表数据
                //oCn.RunProc($"Update KF_PonderationBillMain_Temp set HQty = {HQty} where HBarCode<>'' and HInterID={HInterID.ToString()} and HBillType='{HBillType}' and HBarCode='{HBarCode}'", ref DBUtility.ClsPub.sExeReturnInfo);
                //根据条码自增列 æ›´æ–° æ¡ç å‡ºå…¥åº“缓存表数据
                oCn.RunProc($"exec h_p_KF_PonderationBillMain_Temp_Update {HInterID}, '{HBillType}', '{HBarCode}', {HQty}, {HItemID}", ref DBUtility.ClsPub.sExeReturnInfo);
                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.Message.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region æ‰«ç æ¨¡å—    æ ¹æ®HItemID删除缓存列表中对应条码记录
        /// <summary>
@@ -2535,6 +2627,11 @@
                {
                    sFormId = "STK_MISCELLANEOUS";
                }
                //受托加工入库单
                else if (HBillType == "1212")
                {
                    sFormId = "STK_OEMInStock";
                }
                //领料出库单
                else if (HBillType == "1204")
                {
@@ -2564,6 +2661,11 @@
                else if (HBillType == "1255")
                {
                    sFormId = "SUB_FEEDMTRL";
                }
                //受托加工出库单(受托加工退料)
                else if (HBillType == "1213")
                {
                    sFormId = "STK_OEMInStockRETURN";
                }
                //直接调拨单
                else if (HBillType == "1207")
@@ -2942,6 +3044,7 @@
        /// <returns></returns>
        [Route("WEBSController/set_SavePOStockInBill_Json")]
        [HttpPost]
        [Permission(HModName = "Kf_POStockInBill", Operate = "_Edit")]
        public object set_SavePOStockInBill_Json([FromBody] JObject oMain)
        {
            var _value = oMain["oMain"].ToString();
@@ -3291,6 +3394,89 @@
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "其他入库校验失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
        #region å—托加工入库    ä¸Šä¼ ç”Ÿå•
        #region å—托加工入库    æ–°å¢žæ¨¡å¼
        /// <summary>
        /// å—托加工入库新增上传
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_SaveInceptEntInBill_Json")]
        [HttpPost]
        public object set_SaveInceptEntInBill_Json([FromBody] JObject oMain)
        {
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            try
            {
                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.HStockStyle = lsmain[0].HStockStyle;
                websLsmain.HBillSubType = lsmain[0].HBillSubType;
                if (lsmain[0].HMainSourceBillType == "1130")
                {
                    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_SaveInceptEntInBill_New(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;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "受托加工入库单上传失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -6548,6 +6734,48 @@
            try
            {
                WebSoBar = oWebs.get_SourceBarCode_OtherIn(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_InceptEntIn_Json")]
        [HttpGet]
        public object get_SourceBarCode_InceptEntIn_Json(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HStockOrgID)
        {
            try
            {
                WebSoBar = oWebs.get_SourceBarCode_InceptEntIn(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, ref DBUtility.ClsPub.sErrInfo);
                if (WebSoBar == null)
                {
                    objJsonResult.code = "0";
@@ -14655,8 +14883,8 @@
            {
                string sErrMsg = "";
                oSystemParameter.ShowBill(ref sErrMsg);
                // åŽèˆŸå®¢æˆ·
                if (oSystemParameter.omodel.WMS_CampanyName == "华舟")
                // åŽèˆŸå®¢æˆ·   å·¥åºè¿›ç«™æŽ¥æ”¶å•  å·¥åºå§”外接收单 ç”Ÿäº§è®¢å• å·¥åºæµè½¬å¡
                if (oSystemParameter.omodel.WMS_CampanyName == "华舟" && HSourceBillType != 3790 && HSourceBillType != 3793 && HSourceBillType != 3710 && HSourceBillType != 3772)
                {
                    if (!string.IsNullOrWhiteSpace(HBarCode))
                    {
@@ -14710,6 +14938,14 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Columns.Contains("HBack") && 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;
                }
                if (oSystemParameter.omodel.WMS_CampanyName == "华舟")
                {