yusijie
2023-11-15 33cfe29fcdd731c3c759dcae74bdcfaeecd309ea
WebAPI/Controllers/ÌõÂë¹ÜÀí/WEBSController.cs
@@ -95,6 +95,56 @@
        #endregion
        #region æ ¹æ®æ¡ç ï¼Œè¿”回条码档案中条码信息
        /// <summary>
        /// æ ¹æ®æ¡ç ï¼Œè¿”回条码档案中条码信息
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/GetBarCode_Json")]
        [HttpGet]
        public object GetBarCode_Json(string HBarCode)
        {
            try
            {
                ds = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill where HBarCode='" + HBarCode + "' order by HStopflag", "h_v_Gy_BarCodeBill");
                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.isBool(ds.Tables[0].Rows[0]["HStopflag"]))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "条码已被禁用,不允许扫描!";
                    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
        #endregion
@@ -609,6 +659,38 @@
        #endregion
        #region æ‰«ç æ¨¡å—    æ ¹æ®HItemID删除缓存列表中对应条码记录
        /// <summary>
        /// æ ¹æ®HItemID删除条码出入库缓存表中记录
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_DelPonderationBillMain_Temp_HItemID_Json")]
        [HttpGet]
        public object set_DelPonderationBillMain_Temp_HItemID_Json(long HInterID, string HBillType, long HItemID)
        {
            try
            {
                oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + HBillType + "' and HItemID=" + HItemID.ToString(), 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>
@@ -990,7 +1072,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "其他出库单上传失败!" + e.ToString();
                objJsonResult.Message = "其他入库单上传失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -1002,6 +1084,88 @@
        #region é”€å”®å‡ºåº“    ä¸Šä¼ ç”Ÿå•
        #region é”€å”®å‡ºåº“    æ–°å¢žæ¨¡å¼
        /// <summary>
        /// é”€å”®å‡ºåº“新增上传
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_SaveSellOutBill_Json")]
        [HttpPost]
        public object set_SaveSellOutBill_Json([FromBody] JObject oMain)
        {
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            try
            {
                List<Model.ClsKf_SellOutBillMain> lsmain = new List<Model.ClsKf_SellOutBillMain>();
                ListModels oListModels = new ListModels();
                lsmain = oListModels.getSellOutBillMainByJson(msg1);
                WebS.ClsKf_SellOutBillMain websLsmain = new WebS.ClsKf_SellOutBillMain();
                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;
                if (lsmain[0].HMainSourceBillType == "1402")
                {
                    websLsmain.HMainSourceBillType = "发货通知单";
                }
                else if (lsmain[0].HMainSourceBillType == "1401")
                {
                    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_SaveSellOutBill_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;
            }
        }
        #endregion
        #region é”€å”®å‡ºåº“    æ ¡éªŒæ¨¡å¼
@@ -2096,6 +2260,57 @@
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "获取列表信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region æ ¹æ®å•据ID、物料ID返回条码临时表中条码信息
        /// <summary>
        ///  æ ¹æ®å•据ID、物料ID返回条码临时表中条码信息
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/GetBarCodeByMaterID_Temp_Json")]
        [HttpGet]
        public object GetBarCodeByMaterID_Temp_Json(Int64 HInterID, string HBillType, Int64 HMaterID)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_WMS_BarCodeByMaterID_Temp " + HInterID.ToString() + ",'" + HBillType + "'," + HMaterID.ToString(), "h_p_WMS_BarCodeByMaterID_Temp");
                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 = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "根据物料返回缓存列表条码信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -3458,6 +3673,235 @@
        }
        #endregion
        #region å·¥åºæµè½¬å¡åˆ—表查询调用方法
        #region å•据列表调用方法
        /// <summary>
        /// èŽ·å–æ¡ç ä¿¡æ¯
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/GetMES_ProcessExchangeBillList_PDA_QiaoYi_Json")]
        [HttpGet]
        public object GetMES_ProcessExchangeBillList_PDA_QiaoYi_Json(string HBillNo, string HNumber, string HName, string HICMOBillNo, string user)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_MES_ProcessExchangeBillList_PDA_QiaoYi '" + HBillNo + "','" + HNumber + "','" + HName + "','" + HICMOBillNo + "'", "h_p_MES_ProcessExchangeBillList_PDA_QiaoYi");
                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 = ds.Tables[0];
                    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>
        /// æŸ¥çœ‹æ˜Žç»†
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/GetMES_ProcessExchangeSubBillList_PDA_QiaoYi_Json")]
        [HttpGet]
        public object GetMES_ProcessExchangeSubBillList_PDA_QiaoYi_Json(string HInterID, string user)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_MES_ProcessExchangeSubBillList_PDA_QiaoYi '" + HInterID+ "'", "h_p_MES_ProcessExchangeSubBillList_PDA_QiaoYi");
                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 = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                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/GetMES_Sc_ICMOBillList_PDA_QiaoYi_Json")]
        [HttpGet]
        public object GetMES_Sc_ICMOBillList_PDA_QiaoYi_Json(string HBillNo, string HNumber, string HMaterName, string HDeptName, string user)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_MES_Sc_ICMOBillList_PDA_QiaoYi '" + HBillNo + "','" + HNumber + "','" + HMaterName + "','" + HDeptName + "'", "h_p_MES_Sc_ICMOBillList_PDA_QiaoYi");
                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 = ds.Tables[0];
                    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>
        /// æŸ¥çœ‹æ˜Žç»†
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/GetMES_Sc_ICMOSubBillList_PDA_QiaoYi_Json")]
        [HttpGet]
        public object GetMES_Sc_ICMOSubBillList_PDA_QiaoYi_Json(string HInterID, string HDATA, string user)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_MES_Sc_ICMOSubBillList_PDA_QiaoYi '" + HInterID + "'", "h_p_MES_Sc_ICMOSubBillList_PDA_QiaoYi");
                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列对象的列名
                    }
                   if (HDATA=="HSPE")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "成功!";
                        objJsonResult.data = ds.Tables[0];
                        objJsonResult.list = columnNameList;
                        return objJsonResult;
                    }
                   else if (HDATA == "HICM")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "成功!";
                        objJsonResult.data = ds.Tables[1];
                        objJsonResult.list = columnNameList;
                        return objJsonResult;
                    }
                   else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "成功!";
                        objJsonResult.data = ds.Tables[2];
                        objJsonResult.list = columnNameList;
                        return objJsonResult;
                    }
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
        #region æŠ¥è¡¨æ•°æ®èŽ·å–æ–¹æ³•
        #region æ¡ç å‡ºå…¥åº“记录报表