zrg
2024-07-16 ace57897fc40d465114820fcf1c3c87f9bf42f42
WebAPI/Controllers/ÌõÂë¹ÜÀí/WEBSController.cs
@@ -7443,6 +7443,65 @@
        #endregion
        #region å®¢æˆ·æ¡ç æ‰«æè®°å½•单
        #region å®¢æˆ·æ¡ç æ‰«æè®°å½•单 åˆ¤æ–­å•据号是否为缓存列表中的单据号,是 åˆ™æˆåŠŸå¹¶è¿”å›žæ•°æ®ï¼Œå¦ åˆ™åˆ¤æ–­å¤±è´¥ã€‚
        [Route("WEBSController/Gy_getCusBarCodeBill_judgeHBillNoIsInTempList")]
        [HttpGet]
        public object Gy_getCusBarCodeBill_judgeHBillNoIsInTempList(Int64 HInterID, string HBillNo, string HBillType, string HMaker, Int64 HStockOrgID)
        {
            try
            {
                //判断修改后的单据号,与原内码,是否存在对应已经上传的单据信息
                string sql = "select * from Gy_getCusBarCodeBillMain " +
                    "where HInterID = " + HInterID + " " +
                    "and HBillNo = '" + HBillNo + "' " +
                    "and HBillType = '" + HBillType + "' " +
                    "and HMaker = '" + HMaker + "' " +
                    "and HOrgID = " + HStockOrgID;
                DataSet ds = oCn.RunProcReturn(sql, "Gy_getCusBarCodeBillMain");
                if(ds!=null && ds.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "修改失败!原因:修改单据号与内码对应的单据已经提交!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //判断修改后的单据号,与原内码,是否存在对应已经上传的单据信息
                string sql1 = "select top(1)* from Gy_getCusBarCodeBill_Temp " +
                    "where HBillNo = '" + HBillNo + "' " +
                    "and HBillType = '" + HBillType + "' " +
                    "and HMaker = '" + HMaker + "' " +
                    "and HOrgID = " + HStockOrgID;
                DataSet ds1 = oCn.RunProcReturn(sql1, "Gy_getCusBarCodeBill_Temp");
                if (ds1 != null && ds1.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功";
                    objJsonResult.data = ds1.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "修改失败!原因:" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å®¢æˆ·æ¡ç æ‰«æè®°å½•单 æ‰«ææ¡ç 
        /// <summary>
        /// ç”Ÿäº§ç»„托单模块 æ‰«ææ‰˜æ¡ç 
@@ -8056,12 +8115,12 @@
                if (sWhere == null || sWhere == "")
                {
                    sql = "select top(1000)* from h_v_Gy_getCusBarCodeBillList_Query order by åˆ¶å•日期 desc";
                    sql = "select * from h_v_Gy_getCusBarCodeBillList_Query order by åˆ¶å•日期 desc";
                    ds = oCn.RunProcReturn(sql, "h_v_Gy_getCusBarCodeBillList_Query");
                }
                else
                {
                    sql = "select top(1000)* from h_v_Gy_getCusBarCodeBillList_Query where 1=1 " + sWhere + " order by åˆ¶å•日期 desc";
                    sql = "select * from h_v_Gy_getCusBarCodeBillList_Query where 1=1 " + sWhere + " order by åˆ¶å•日期 desc";
                    ds = oCn.RunProcReturn(sql, "h_v_Gy_getCusBarCodeBillList_Query");
                }
@@ -8101,6 +8160,497 @@
            }
        }
        #endregion
        #region å®¢æˆ·æ¡ç æ‰«æè®°å½•单 ç»´æŠ¤åˆ—表-条码列表
        /// <summary>
        /// è¿”回组托列表信息
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Gy_getCusBarCodeBill_rushedBarCodeList_CodeList")]
        [HttpGet]
        public object Gy_getCusBarCodeBill_rushedBarCodeList_CodeList(long HInterID, string HBillNo, string HBillType, long HOrgID)
        {
            try
            {
                string sql = "select * from Gy_getCusBarCodeBill_Temp where HBillNo = '" + HBillNo + "' and HBillType = '" + HBillType + "' and HOrgID = " + HOrgID + " Order by HDate desc";
                ds = oCn.RunProcReturn(sql, "Gy_getCusBarCodeBill_Temp");
                if (ds == null)
                {
                    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 æ‰«ç éªŒè¯å• æ‰«ç ç‰©æ–™æ¡ç 
        [Route("WEBSController/Gy_BarCodeConfirmBill_rushBarCode")]
        [HttpGet]
        public object Gy_BarCodeConfirmBill_rushBarCode(Int64 HInterID, string HBillNo, string HBillType, string HMaker, Int64 HStockOrgID, string HBarCode)
        {
            DataSet ds;
            try
            {
                string sql = "exec h_p_Gy_BarCodeConfirmBill_rushBarCode " + HInterID + ",'" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HStockOrgID + ",'" + HBarCode + "'";
                ds = oCn.RunProcReturn(sql, "h_p_Gy_BarCodeConfirmBill_rushBarCode");
                if(ds==null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "扫描条码失败!原因:扫码条码错误,请寻找IT人员!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "扫描条码失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                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;
            }
        }
        #endregion
        #region æ‰«ç éªŒè¯å• è¿”回扫描条码列表信息
        [Route("WEBSController/Gy_BarCodeConfirmBill_rushedBarCodeList")]
        [HttpGet]
        public object Gy_BarCodeConfirmBill_rushedBarCodeList(long HInterID, string HBillNo, string HBillType, long HOrgID)
        {
            try
            {
                string sql = "select * from h_v_Gy_BarCodeConfirmBillTempList_singleBill " +
                    "where HInterID = " + HInterID + " and å•据号 = '" + HBillNo + "' and HBillType = '" + HBillType + "' and HOrgID = " + HOrgID + " Order by æ‰«ç æ—¶é—´ desc";
                ds = oCn.RunProcReturn(sql, "h_v_Gy_BarCodeConfirmBillTempList_singleBill");
                if (ds == null)
                {
                    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/Gy_BarCodeConfirmBill_DeleteRushedBarCodeList")]
        [HttpGet]
        public object Gy_BarCodeConfirmBill_DeleteRushedBarCodeList(Int64 HInterID, string HBillNo, string HBillType, string HBarCode, string HMaker, Int64 HStockOrgID)
        {
            try
            {
                string sql = "delete from Gy_BarCodeConfirmBillTempList " +
                    "where HInterID = " + HInterID + "" +
                    " and HBillNo = '" + HBillNo + "'" +
                    " and HBillType = '" + HBillType + "'" +
                    " and HStockOrgID = " + HStockOrgID + "" +
                    " and HBarCode = '" + HBarCode + "'";
                oCn.RunProc(sql);
                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;
            }
        }
        #endregion
        #region æ‰«ç éªŒè¯å• è¿”回缓存列表信息
        [Route("WEBSController/Gy_BarCodeConfirmBill_TempList")]
        [HttpGet]
        public object Gy_BarCodeConfirmBill_TempList(string HBillType, string HMaker, long HStockOrgID)
        {
            DataSet ds;
            try
            {
                string sql = "exec h_p_Gy_BarCodeConfirmBill_TempList '" + HBillType + "','" + HMaker + "'," + HStockOrgID;
                ds = oCn.RunProcReturn(sql, "h_p_Gy_BarCodeConfirmBill_TempList");
                if (ds == null)
                {
                    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/Gy_BarCodeConfirmBill_DeleteTempListNote")]
        [HttpGet]
        public object Gy_BarCodeConfirmBill_DeleteTempListNote(Int64 HInterID, string HBillNo, string HBillType, string HMaker, Int64 HStockOrgID)
        {
            DataSet ds;
            try
            {
                //删除前控制============================================================================================================================
                string sql_beforeDeleteTempListNote = "exec h_p_Gy_BarCodeConfirmBill_beforeDeleteTempListNote " + HInterID + ",'" + HBillNo + "','" + HBillType + "'," + HStockOrgID + ",'" + HMaker + "'";
                ds = oCn.RunProcReturn(sql_beforeDeleteTempListNote, "h_p_Gy_BarCodeConfirmBill_beforeDeleteTempListNote");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!原因:删除前控制失败,请寻找网络管理人员";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=============================================================================================================================================
                //开启事务
                oCn.BeginTran();
                string sql = "delete from Gy_BarCodeConfirmBillTempList where " +
                    " HInterID = " + HInterID + "" +
                    " and HBillNo = '" + HBillNo + "'" +
                    " and HBillType = '" + HBillType + "'" +
                    " and HStockOrgID = " + HStockOrgID + "";
                oCn.RunProc(sql);
                //删除后控制============================================================================================================================
                string sql_afterDeleteTempListNote = "exec h_p_Gy_BarCodeConfirmBill_afterDeleteTempListNote " + HInterID + ",'" + HBillNo + "','" + HBillType + "'," + HStockOrgID + ",'" + HMaker + "'";
                ds = oCn.RunProcReturn(sql_afterDeleteTempListNote, "h_p_Gy_BarCodeConfirmBill_afterDeleteTempListNote");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!原因:删除后控制失败,请寻找网络管理人员";
                    objJsonResult.data = null;
                    oCn.RollBack();
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
                    objJsonResult.data = null;
                    oCn.RollBack();
                    return objJsonResult;
                }
                //=============================================================================================================================================
                oCn.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功!";  //成功!
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region æ‰«ç éªŒè¯å• ç»´æŠ¤åˆ—表
        /// <summary>
        /// è¿”回组托缓存列表信息
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Gy_BarCodeConfirmBillList")]
        [HttpGet]
        public object Gy_BarCodeConfirmBillList(string sWhere, string user)
        {
            DataSet ds;
            try
            {
                string sql = "";
                if (sWhere == null || sWhere == "")
                {
                    sql = "select * from h_v_Gy_BarCodeConfirmBillList_Query order by æ—¥æœŸ desc";
                    ds = oCn.RunProcReturn(sql, "h_v_Gy_BarCodeConfirmBillList_Query");
                }
                else
                {
                    sql = "select * from h_v_Gy_BarCodeConfirmBillList_Query where 1=1 " + sWhere + " order by æ—¥æœŸ desc";
                    ds = oCn.RunProcReturn(sql, "h_v_Gy_BarCodeConfirmBillList_Query");
                }
                if (ds == null)
                {
                    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 = "1";
                    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/Gy_BarCodeConfirmBill_rushedBarCodeList_CodeList")]
        [HttpGet]
        public object Gy_BarCodeConfirmBill_rushedBarCodeList_CodeList(long HSourceInterID, string HSourceEntryID, string HSourceBillType, long HOrgID)
        {
            try
            {
                string sql = "select * from Gy_BarCodeConfirmBillTempList where HSourceInterID = " + HSourceInterID + " and HSourceEntryID = " + HSourceEntryID + " and HSourceBillType = '" + HSourceBillType + "' and HStockOrgID = " + HOrgID + " Order by HMakeDate desc";
                ds = oCn.RunProcReturn(sql, "Gy_BarCodeConfirmBillTempList");
                if (ds == null)
                {
                    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/Gy_BarCodeConfirmBill_rushedBarCodeList_waitCodeList")]
        [HttpGet]
        public object Gy_BarCodeConfirmBill_rushedBarCodeList_waitCodeList(long HSourceInterID, string HSourceEntryID, string HSourceBillType, long HOrgID)
        {
            try
            {
                string sql = "exec h_p_Gy_BarCodeConfirmBill_waitRushBarCodeList " + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillType + "'," + HOrgID;
                ds = oCn.RunProcReturn(sql, "h_p_Gy_BarCodeConfirmBill_waitRushBarCodeList");
                if (ds == null)
                {
                    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
    }
}