WebAPI/Controllers/ÌõÂë¹ÜÀí/WEBSController.cs
@@ -46,6 +46,7 @@
        /// <returns></returns>
        [Route("WEBSController/GetUser_Json")]
        [HttpGet]
        [AllowAnonymous]
        public object GetUser_Json(string HUserNumber, string HPassWord, Int64 HStockOrgID, string HStockOrgName)
        {
            try
@@ -91,11 +92,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]["Czmm"].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)
@@ -1556,6 +1569,84 @@
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除条码出入库缓存列表条码记录失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #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.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -5259,7 +5350,7 @@
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_SaveQCPOStockInCheckBill_Json")]
        [HttpPost]
        [HttpGet]
        public object set_SaveQCPOStockInCheckBill_Json(Int64 HInterID, string HBillNo, string HSourceBillType, string HSourceBillNo, Int64 HSourceInterID, string sHSourceEntryID, Int64 HFirstCheckEmp, string HMaker)
        {
            try
@@ -5395,16 +5486,16 @@
                    oSub.HBadQty = Pub_Class.ClsPub.isDoule(Ds.Tables[1].Rows[i]["HBadQty"]);
                    oCn.RunProc("Insert Into QC_POStockInCheckBillSub " +
                    "(HInterID,HEntryID,,HBillNo_bak,HRemark" +
                    "(HInterID,HEntryID,HBillNo_bak,HRemark" +
                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
                    ",HQCCheckClassID,HQCCheckItemID,HQCStd,HQCRelValue" +
                    "HResult,HProcCheckEmp,HProcCheckTime" +
                    "HMaterID,HInStockQty,HCheckQty,HRightQty,HBadQty" +
                    ",HResult,HProcCheckEmp,HProcCheckTime" +
                    ",HMaterID,HInStockQty,HCheckQty,HRightQty,HBadQty" +
                    ") " +
                    " values(" + oMain.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oMain.HBillNo + "','" + oSub.HRemark + "'" +
                    ", " + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" +
                    ", " + oSub.HQCCheckClassID.ToString() + "," + oSub.HQCCheckItemID.ToString() + ",'" + oSub.HQCStd + "','" + oSub.HQCRelValue + "'" +
                    ",'" + oSub.HResult + "'," + oSub.HProcCheckEmp.ToString() + "',getdate()" +
                    ",'" + oSub.HResult + "'," + oSub.HProcCheckEmp.ToString() + ",getdate()" +
                    ", " + oSub.HMaterID.ToString() + "," + oSub.HInStockQty.ToString() + "," + oSub.HCheckQty.ToString() + "," + oSub.HRightQty.ToString() + "," + oSub.HBadQty.ToString() +
                    ") ");
                }
@@ -5692,7 +5783,6 @@
                if (isSuccess == 1)
                {
                    string result = InvokeHelper.Save("QM_InspectBill", sJson); //保存
                    sRemark = sRemark + " ï¼›ç”ŸæˆCLOUD单据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
                    HReturn = result.ToString();
@@ -5716,6 +5806,24 @@
                    else
                    {
                        sRemark = sRemark + sJson;
                        // æäº¤å’Œä¿å­˜å•据
                        string result1 = string.Empty;
                        string result2 = string.Empty;
                        var fID = JObject.Parse(result)["Result"]["Id"].ToString();
                        var fBillNo = JObject.Parse(result)["Result"]["Number"].ToString();
                        var json = new
                        {
                            Ids = fID,
                        };
                        result1 = InvokeHelper.Submit("QM_InspectBill", JsonConvert.SerializeObject(json));//提交
                        result2 = InvokeHelper.Audit("QM_InspectBill", JsonConvert.SerializeObject(json));//审核
                        if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                        {
                            oCn.RollBack();
                            sErrMsg = $"来料检验单号:{fBillNo},提交失败" + result;
                            return false;
                        }
                        oCn.Commit();
                    }
                }
@@ -14932,7 +15040,7 @@
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.count = 1;
                objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //成功!
                objJsonResult.data = oDs.Tables[0];
                return objJsonResult;