WebAPI/Controllers/ÌõÂë¹ÜÀí/WEBSController.cs
@@ -2600,7 +2600,7 @@
        {
            //sCloudMode:系统参数  æ˜¯å¦ä¸ºç§æœ‰äº‘模式(N为公有云模式,Y为私有云模式);
            //sERPMode:系统参数  åº“存控制-WMS库存控制ERP模式   (WISE、CLOUD、MES);
            //sHType:值 1 å¯¹åº”缓存列表删除;值 2 å¯¹åº”已上传撤销;
            //sHType:值 1 å¯¹åº”缓存列表删除;值 2 å¯¹åº”已上传撤销;值 3 å¯¹åº”校验模块已上传撤销;
            //公有云模式
            if (sCloudMode == "N")
@@ -2626,6 +2626,11 @@
                else if (HBillType == "1203")
                {
                    sFormId = "STK_MISCELLANEOUS";
                }
                //受托加工入库单
                else if (HBillType == "1212")
                {
                    sFormId = "STK_OEMInStock";
                }
                //领料出库单
                else if (HBillType == "1204")
@@ -2656,6 +2661,11 @@
                else if (HBillType == "1255")
                {
                    sFormId = "SUB_FEEDMTRL";
                }
                //受托加工出库单(受托加工退料)
                else if (HBillType == "1213")
                {
                    sFormId = "STK_OEMInStockRETURN";
                }
                //直接调拨单
                else if (HBillType == "1207")
@@ -2728,7 +2738,7 @@
                    var sJson = new
                    {
                        FormId = sFormId,
                        FieldKeys = "FBillNo",
                        FieldKeys = "FBillNo,FAPPROVERID",
                        FilterString = $@"FBillNo='{HBillNo}'",
                        OrderString = "",
                        TopRowCount = 0,
@@ -2760,7 +2770,7 @@
                            }
                        }
                        //sHType = 2对应已上传撤销
                        else
                        else if(sHType == 2)
                        {
                            //判断返回的数组数据中是否存在"false",存在代表递入的业务对象表单Id不正确
                            if (_saveObj[0][0].ToString().Contains("false") == true)
@@ -2774,26 +2784,73 @@
                                return false;
                            }
                        }
                        //sHType = 3对应校验模块已上传撤销
                        else if (sHType == 3)
                        {
                            //判断返回的数组数据中是否存在"false",存在代表递入的业务对象表单Id不正确
                            if (_saveObj[0][0].ToString().Contains("false") == true)
                            {
                                sErrMsg = "此模块暂不支持撤销功能!";
                                return false;
                            }
                            else if (_saveObj[0][1].ToString() != "0")
                            {
                                sErrMsg = "校验撤销单据失败,单据号:" + HBillNo + ",金蝶云里已审核,不允许撤销!";
                                return false;
                            }
                            else
                            {
                                return true;
                            }
                        }
                        else
                        {
                            sErrMsg = "sHType值递入错误!";
                            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)
                //sHType = 3    æ‰«ç æ ¡éªŒæ¨¡å—
                if (sHType == 3)
                {
                    sErrMsg = "单据查询发生错误!";
                    return false;
                    ds = oCn.RunProcReturn("exec h_p_WMS_BillQuery_BillCheck " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + sERPMode + "'", "h_p_WMS_BillQuery_BillCheck");
                    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;
                    }
                }
                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
                {
                    sErrMsg = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                    return false;
                }
                //sHType = 1 æˆ– sHType = 2   æ‰«ç æ–°å¢žæ¨¡å—
                else
                {
                    return true;
                    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;
                    }
                }
            }
        }
@@ -3384,6 +3441,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;
            }
@@ -4261,6 +4401,64 @@
                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_SaveInceptEntOutBill_BillCheck_Json")]
        [HttpPost]
        public object set_SaveInceptEntOutBill_BillCheck_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);
                WebAPI.WebS.ClsKf_ICStockBillMain websLsmain = new WebS.ClsKf_ICStockBillMain();
                websLsmain.HInterID = lsmain[0].HInterID;
                websLsmain.HBillNo = lsmain[0].HBillNo;
                websLsmain.HBillType = "1213";
                websLsmain.HMaker = lsmain[0].HMaker;
                websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
                if (oWebs.set_SaveInceptEntOutBill_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;
            }
@@ -6670,6 +6868,48 @@
        #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";
                    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>
@@ -7949,6 +8189,20 @@
                        sAutoBarCode = "Y";
                    }
                }
                //受托加工入库单
                else if (HBillType == "1212")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_InceptEntInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_InceptEntInBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
                }
                //领料出库单
                else if (HBillType == "1204")
                {
@@ -8029,6 +8283,20 @@
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
                }
                //受托加工出库单
                else if (HBillType == "1213")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_InceptEntOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //免扫物料条码模式('Y'为不扫物料条码)
                    if (oSystemParameter.omodel.Kf_InceptEntOutBillCheck_AutoBarCode.ToUpper() == "Y")
                    {
                        sAutoBarCode = "Y";
                    }
@@ -8564,6 +8832,14 @@
                {
                    sFIFOCtl = "Y";
                }
                //受托加工出库单-先进先出控制
                if (HBillType == "1213"
                    && oSystemParameter.omodel.Kf_InceptEntOutBillCheck_AutoBarCode.ToUpper() == "N"         //免扫物料条码模式('Y'为不扫物料条码)
                    && oSystemParameter.omodel.Kf_InceptEntOutBillCheck_SourceBarCodeCtl.ToUpper() == "N"    //校验-是否进行源单对应条码核对('Y'为核对)
                    && (oSystemParameter.omodel.Kf_InceptEntOutBillCheck_FIFOCtl == "1" || oSystemParameter.omodel.Kf_InceptEntOutBillCheck_FIFOCtl == "2" || oSystemParameter.omodel.Kf_InceptEntOutBillCheck_FIFOCtl == "3"))
                {
                    sFIFOCtl = "Y";
                }
                //直接调拨单-先进先出控制
                if (HBillType == "1207"
                    && oSystemParameter.omodel.Kf_MoveStockBillCheck_AutoBarCode.ToUpper() == "N"         //免扫物料条码模式('Y'为不扫物料条码)
@@ -8706,6 +8982,15 @@
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //受托加工入库单
                else if (HBillType == "1212")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_InceptEntInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //领料出库单
                else if (HBillType == "1204")
                {
@@ -8771,6 +9056,17 @@
                    }
                    //先进先出控制
                    sFIFOCtl = oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_FIFOCtl;
                }
                //受托加工出库单
                else if (HBillType == "1213")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_InceptEntOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                    //先进先出控制
                    sFIFOCtl = oSystemParameter.omodel.Kf_InceptEntOutBillCheck_FIFOCtl;
                }
                //直接调拨单
                else if (HBillType == "1207")
@@ -9079,6 +9375,15 @@
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //受托加工入库单
                else if (HBillType == "1212")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_InceptEntInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //领料出库单
                else if (HBillType == "1204")
                {
@@ -9129,6 +9434,15 @@
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
                }
                //受托加工出库单
                else if (HBillType == "1213")
                {
                    //校验-是否进行源单对应条码核对('Y'为核对)
                    if (oSystemParameter.omodel.Kf_InceptEntOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                    {
                        sSourceBarCodeCtl = "Y";
                    }
@@ -9188,6 +9502,16 @@
                    }
                }
                #endregion
                //撤销前判断金蝶云中单据是否存在
                if (!GetBillQuery_WMS(HInterID, HBillNo, HBillType, HMaker, oSystemParameter.omodel.WMS_CloudMode, sERPMode, 3, ref sErrMsg))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = sErrMsg;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                try
                {
@@ -12940,6 +13264,60 @@
        #endregion
        #region  WMS每日运行状态分析(每日制单数量)
        [Route("WEBSController/GetKf_WMSDailyRunStateReport_Json")]
        [HttpGet]
        public object GetKf_WMSDailyRunStateReport_Json(string sWhere, string user)
        {
            try
            {
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
                string HBeginDate = dic["HBeginDate"].ToString();
                string HEndDate = dic["HEndDate"].ToString();
                List<object> columnNameList = new List<object>();
                ds = oCn.RunProcReturn("exec h_p_Kf_WMSDailyRunStateReport  '" + HBeginDate + "','" + HEndDate + "'", "h_p_Kf_WMSDailyRunStateReport");
                if (ds.Tables[0].Rows.Count != 0 || ds != null)
                {
                    //添加列名
                    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 = "Sucess!";
                    objJsonResult.data = ds;
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无数据";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
@@ -14748,8 +15126,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))
                    {