yangle
2024-11-28 f9c66dcfca26da4eeba5c87df4ca3916461e37f8
WebAPI/Controllers/ÌõÂë¹ÜÀí/WEBSController.cs
@@ -35,9 +35,6 @@
        string ComputerName = SystemInformation.ComputerName;   //设备名称
        WebS.ClsXt_SystemParameterMain oSystemParameterMain = new WebS.ClsXt_SystemParameterMain();
        #region å…¬ç”¨æ–¹æ³•
        #region è´¦å·ç™»å…¥
@@ -2272,6 +2269,88 @@
        #endregion
        #region å…¶ä»–入库    æ ¡éªŒæ¨¡å¼
        /// <summary>
        /// å…¶ä»–入库校验上传
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_SaveOtherInBill_BillCheck_Json")]
        [HttpPost]
        public object set_SaveOtherInBill_BillCheck_Json([FromBody] JObject oMain)
        {
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string sMainStr = sArray[0].ToString();             //单据数据
            string HSourceBarCodeCtl = sArray[1].ToString();    //校验-是否进行源单对应条码核对('Y'为核对)
            try
            {
                List<Model.ClsKf_OtherInBillMain> lsmain = new List<Model.ClsKf_OtherInBillMain>();
                ListModels oListModels = new ListModels();
                lsmain = oListModels.getOtherInBillMainByJson(sMainStr);
                WebAPI.WebS.ClsKf_OtherInBillMain websLsmain = new WebS.ClsKf_OtherInBillMain();
                websLsmain.HInterID = lsmain[0].HInterID;
                websLsmain.HBillNo = lsmain[0].HBillNo;
                websLsmain.HBillType = "1203";
                websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
                //原单据为扫码生成,对原扫描的条码进行核对
                if (HSourceBarCodeCtl == "Y")
                {
                    if (oWebs.set_SaveOtherInBill_CLD_BillCheck_Verify(websLsmain, 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
                {
                    if (oWebs.set_SaveOtherInBill_CLD_BillCheck(websLsmain, 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;
            }
        }
        #endregion
        #endregion
        #region é¢†æ–™å‡ºåº“    ä¸Šä¼ ç”Ÿå•
@@ -4417,6 +4496,7 @@
                                    FentityModel.Add("F_paez_BaseQty", item["实发数量"].ToString()); //实发数量
                                    FentityModel.Add("F_paez_Qty1", item["实收数量"].ToString()); //实收数量
                                    FentityModel.Add("F_paez_Text2", item["箱号"].ToString()); //箱号 ???不能为数字
                                    FentityModel.Add("FLOT", new JObject() { ["FNumber"] = item["批号"].ToString() });  // è¾…计量单位代码
                                    //JArray Fentity2 = new JArray();
@@ -4457,7 +4537,7 @@
                                //从配置文件获取 CLOUD网址、账套信息、登录用户、登录密码
                                if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
                                {
                                    oCn.RollBack();
                                    //oCn.RollBack();
                                    objJsonResult.code = "0";
                                    objJsonResult.count = 0;
                                    objJsonResult.Message = "入库申请单同步获取登录账号密码失败!";
@@ -4473,7 +4553,7 @@
                                if (isSuccess == 0)
                                {
                                    LogService.Write("其他入库,登录金蝶失败!");
                                    oCn.RollBack();
                                    //oCn.RollBack();
                                    objJsonResult.code = "0";
                                    objJsonResult.count = 0;
                                    objJsonResult.Message = "登录金蝶失败!";
@@ -4487,7 +4567,7 @@
                                    if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                                    {
                                        LogService.Write("入库申请单同步金蝶云失败:" + JsonConvert.SerializeObject(jsonRoot));
                                        oCn.RollBack();
                                        //oCn.RollBack();
                                        objJsonResult.code = "0";
                                        objJsonResult.count = 0;
                                        objJsonResult.Message = "入库申请单同步金蝶云失败!单号:" + HSourceBillNo_TB + result + jsonRoot;
@@ -4511,7 +4591,7 @@
                                        if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                                        {
                                            oCn.RollBack();
                                            //oCn.RollBack();
                                            objJsonResult.code = "0";
                                            objJsonResult.count = 0;
                                            objJsonResult.Message = "入库申请单单号:" + ",提交失败" + result1;
@@ -4521,7 +4601,7 @@
                                        if (JObject.Parse(result2)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                                        {
                                            oCn.RollBack();
                                            //oCn.RollBack();
                                            objJsonResult.code = "0";
                                            objJsonResult.count = 0;
                                            objJsonResult.Message = "入库申请单单号:" + ",审核失败" + result2;
@@ -5073,11 +5153,99 @@
            if (oSystemParameter.ShowBill(ref sErrMsg) == true)
            {
                string sSourceBarCodeCtl = "N";   //校验-是否进行源单对应条码核对('Y'为核对)
                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
                #region ç³»ç»Ÿå‚数获取
                //采购入库单
                if (HBillType == "1201")
                {
                    //销售出库单
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl == "Y")
                    {
                    sSourceBarCodeCtl = "Y";
                }
                }
                //生产入库单
                if (HBillType == "1202")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //其他入库单
                if (HBillType == "1203")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //领料出库单
                else if (HBillType == "1204")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //销售出库单
                else if (HBillType == "1205")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //其他出库单
                else if (HBillType == "1206")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //委外领料单
                else if (HBillType == "1211")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //生产补料单
                else if (HBillType == "1254")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //委外补料单
                else if (HBillType == "1255")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //直接调拨单
                else if (HBillType == "1207")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                #endregion
                if (oSystemParameter.omodel.WMS_CampanyName == "安瑞") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                {
@@ -5153,6 +5321,71 @@
        #endregion
        #region è¿”回单据列表信息    20241114
        /// <summary>
        /// è¿”回单据列表信息    æ ¡éªŒæ¨¡å¼
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/GetKf_PonderationBillMain_Temp_BillCheck_New_Json")]
        [HttpGet]
        public object GetKf_PonderationBillMain_Temp_BillCheck_New_Json(long HInterID, string HBillType, string sWhere, string HSourceBarCodeCtl)
        {
            try
            {
                //原单据为扫码生成,对原扫描的条码进行核对
                if (HSourceBarCodeCtl == "Y")
                {
                    ds = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_TempList_Verify " + HInterID.ToString() + ",'" + HBillType + "','" + sWhere + "'", "h_p_KF_PonderationBillMain_TempList_Verify");
                }
                //原单据非扫码生成
                else
                {
                    ds = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_TempList_BillCheck " + HInterID.ToString() + ",'" + HBillType + "','" + sWhere + "'", "h_p_KF_PonderationBillMain_TempList_BillCheck");
                }
                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 = new
                    {
                        Materlist = ds.Tables[0],           //返回物料明细列表信息(0)
                        BarCodeDetailslist = ds.Tables[1],  //返回当前所扫描条码明细信息(5)
                    };
                    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>
@@ -5204,6 +5437,50 @@
        #endregion
        #region æ ¡éªŒæ‰«ç æ¨¡å—,删除选中行条码出入库临时表记录    20241114
        /// <summary>
        /// æ‰«ç æ¨¡å—,删除选中行条码出入库临时表记录
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_DeleteBarCodeByEntryID_BillCheck_New_Json")]
        [HttpGet]
        public object set_DeleteBarCodeByEntryID_BillCheck_New_Json(long HInterID, string HBillType, long HSourceInterID, long HSourceEntryID, string HSourceBarCodeCtl)
        {
            //原单据为扫码生成,对原扫描的条码进行核对
            if (HSourceBarCodeCtl == "Y")
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "校验条码,无需删除!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            //原单据非扫码生成
            else
            {
                try
                {
                    oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + HBillType + "' and HSourceInterID=" + HSourceInterID.ToString() + " and HSourceEntryID=" + HSourceEntryID.ToString() + " and HQty<>0 ", ref DBUtility.ClsPub.sExeReturnInfo);
                    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
        #region æ‰«ç æ¨¡å—,删除选中行条码出入库临时表记录
        /// <summary>