From 7db98877235dc8dc88e95bd055484265fe6ea72d Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期五, 19 八月 2022 11:03:04 +0800
Subject: [PATCH] WMS条码系统参数新增
---
WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs | 270 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 249 insertions(+), 21 deletions(-)
diff --git a/WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs
index 3939dd1..5da67af 100644
--- a/WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs
+++ b/WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs
@@ -1,4 +1,5 @@
-锘縰sing System;
+锘縰sing Newtonsoft.Json.Linq;
+using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
@@ -21,10 +22,19 @@
#region 璁惧淇濆吇瑙勭▼鍗曞垪琛�
[Route("Sb_EquipMaintainRuleBill/GetEquipMaintainRuleList")]
[HttpGet]
- public object GetEquipMaintainRuleList(string sWhere)
+ public object GetEquipMaintainRuleList(string sWhere,string user)
{
try
{
+ if (!DBUtility.ClsPub.Security_Log("Sb_EquipMaintainRuleBillList", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
if (sWhere == null || sWhere.Equals(""))
{
ds = oCN.RunProcReturn("select * from h_v_Sb_EquipMaintainRuleList " + sWhere + " order by hmainid desc", "h_v_Sb_EquipMaintainRuleList");
@@ -35,22 +45,23 @@
string sql = sql1 + sWhere + " order by hmainid desc";
ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleList");
}
- if (ds == null || ds.Tables[0].Rows.Count == 0)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "娌℃湁浣犺鎵剧殑璁板綍锛�";
- objJsonResult.data = null;
- return objJsonResult;
- }
- else
- {
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
- objJsonResult.data = ds.Tables[0];
- return objJsonResult;
- }
+
+ //if (ds.Tables[0].Rows.Count != 0 || ds != null)
+ //{
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ //}
+ //else
+ //{
+ //objJsonResult.code = "0";
+ //objJsonResult.count = 0;
+ //objJsonResult.Message = "鏃犳暟鎹�";
+ //objJsonResult.data = null;
+ //return objJsonResult;
+ //}
}
catch (Exception ex)
{
@@ -66,8 +77,16 @@
#region 璁惧淇濆吇瑙勭▼璁板綍鍒犻櫎鍔熻兘
[Route("Sb_EquipMaintainRuleBill/DeleteEquipMaintainRuleBillList")]
[HttpGet]
- public object DeleteEquipMaintainRuleBillList(string HInterID)
+ public object DeleteEquipMaintainRuleBillList(string HInterID,string user)
{
+ if (!DBUtility.ClsPub.Security_Log("Sb_EquipMaintainRuleBill_Delete", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
Int64 lngBillKey = 0;
lngBillKey = DBUtility.ClsPub.isLong(HInterID);
if (lngBillKey == 0)
@@ -89,7 +108,7 @@
objJsonResult.data = null;
return objJsonResult;
}
- if (oBill.omodel.HChecker != "")
+ if (oBill.omodel.HChecker != ""&& oBill.omodel.HChecker != null)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -98,7 +117,7 @@
return objJsonResult;
}
- bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
if (IsDete)
{
objJsonResult.code = "0";
@@ -171,5 +190,214 @@
return objJsonResult;
}
#endregion
+
+ #region[璁惧淇濆吇瑙勭▼缂栬緫鏃惰幏鍙栬〃澶存暟鎹甝
+ [Route("Sb_EquipMaintainRuleBill/Sb_EquipMaintainRuleBillListCheckDetai")]
+ [HttpGet]
+ public ApiResult<DataSet> Sb_EquipMaintainRuleBillListCheckDetai(string HID)
+ {
+ if (string.IsNullOrEmpty(HID))
+ return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" };
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ var dataSet = oCN.RunProcReturn("select top 1 * from Sb_EquipMaintainRuleBillMain where HInterID= " + HID + " ", "Sb_EquipMaintainRuleBillMain");
+ if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+ return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ偣妫�璁″垝琛�" };
+ return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+ }
+ #endregion
+
+ # region 璁惧淇濆吇瑙勭▼缂栬緫鏃惰幏鍙栬〃浣撴暟鎹柊(淇濆吇椤瑰垪琛ㄣ�侀厤浠堕」鍒楄〃)
+ [Route("Sb_EquipMaintainRuleBill/Sb_EquipMaintainRuleBillSubAndSubItem")]
+ [HttpGet]
+ public object Sb_EquipMaintainRuleBillSubAndSubItem(string HInterID)
+ {
+
+ DataSet ds, ds1;
+ List<object> list = new List<object>();
+ string Swhere = "";
+ try
+ {
+ if (HInterID != "" || HInterID != null)
+ {
+ Swhere = " and hmainid='" + HInterID + "'";
+ }
+ else
+ {
+ Swhere = HInterID;
+ }
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ //鑾峰彇淇濆吇椤圭洰缂栬緫鏁版嵁
+ string sql = "select 淇濆吇椤圭洰ID HMaintainItemID,淇濆吇椤圭洰浠g爜 HMaintainItemNumber,淇濆吇椤圭洰 HMaintainItem,淇濆吇閮ㄤ綅 HMaintainPart,鍏蜂綋瑕佹眰 HClaim,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜哄悕绉� HManagerName,瀛愬娉�2 HRemark from h_v_Sb_EquipMaintainRuleList where 1 = 1 " + Swhere + "";
+ ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleList");
+ //鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁
+ string sql1 = "select 閰嶄欢ID HMaterID,閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,鍗曚綅ID HUnitID,璁¢噺鍗曚綅浠g爜 HUnitNumber,璁¢噺鍗曚綅鍚嶇О HUnitName,鐢ㄩ噺 HQty,瀛愬娉�1 HRemark from h_v_Sb_EquipMaintainRuleList where 1 = 1 " + Swhere + "";
+ ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainRuleList");
+
+ list.Add(ds.Tables[0]);
+ list.Add(ds1.Tables[0]);
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+ objJsonResult.list = list;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+ objJsonResult.data = null;
+ }
+ return objJsonResult;
+ }
+ #endregion
+
+ #region 璁惧淇濆吇瑙勭▼琛� 淇濆瓨/缂栬緫
+ /// <summary>
+ /// 淇濆瓨妯″叿缁翠慨鍗�
+ /// </summary>
+ /// <param name="msg"></param>
+ /// <returns></returns>
+ [Route("Sb_EquipMaintainRuleBill/SaveEquipMaintainRuleBillList")]
+ [HttpPost]
+ public object SaveEquipMaintainRuleBillList([FromBody] JObject msg)
+ {
+ var _value = msg["msg"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString();
+ string msg4 = sArray[2].ToString();
+ string msg5 = sArray[3].ToString();
+
+ string UserName = "";
+ ListModels oListModels = new ListModels();
+ try
+ {
+ if (!DBUtility.ClsPub.Security_Log("Sb_EquipMaintainRuleBill_Edit", 1, false, msg5))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ DLL.ClsSb_EquipMaintainRuleBill oBill = new DLL.ClsSb_EquipMaintainRuleBill();
+ List<Models.ClsSb_EquipMaintainRuleBillMain> lsmain = new List<Models.ClsSb_EquipMaintainRuleBillMain>();
+ msg2 = msg2.Replace("\\", "");
+ msg2 = msg2.Replace("\n", ""); //\n
+ //涓昏〃
+ lsmain = oListModels.getObjectByJson_Sb_EquipMaintainRuleBillMain(msg2);
+ foreach (Models.ClsSb_EquipMaintainRuleBillMain oItem in lsmain)
+ {
+ UserName = oItem.HMaker; //鍒跺崟浜�
+ oItem.HBillType = "3912";
+ oItem.HBillSubType = "3912";
+
+ oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡
+ oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+ oItem.HPeriod= DBUtility.ClsPub.isLong(DateTime.Now.Month);
+
+ if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ oBill.omodel = oItem;
+ }
+
+ //淇濆吇椤硅〃浣撴暟鎹�
+ //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+ msg3 = msg3.Substring(1, msg3.Length - 2);
+ msg3 = msg3.Replace("\\", "");
+ msg3 = msg3.Replace("\n", ""); //\n
+ //msg2 = msg2.Replace("'", "鈥�");
+ List<Models.ClsSb_EquipMaintainRuleBillSub_Item> ls = new List<Models.ClsSb_EquipMaintainRuleBillSub_Item>();
+ ls = oListModels.getObjectByJson_Sc_EquipMaintainRuleBillSub_Item(msg3);
+ int i = 0;
+ foreach (Models.ClsSb_EquipMaintainRuleBillSub_Item item in ls)
+ {
+
+ i++;
+ item.HEntryID = i;
+ item.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+ item.HCloseType = false; //鍏抽棴绫诲瀷
+ item.HSourceInterID = 0; // 婧愬崟涓诲唴鐮�
+ item.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮�
+ item.HRelationQty = 0; //鍏宠仈鏁伴噺
+ oBill.DetailColl_Pay.Add(item);
+
+ }
+
+
+ //閰嶄欢椤硅〃浣撴暟鎹�
+ //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+ msg4 = msg4.Substring(1, msg4.Length - 2);
+ msg4 = msg4.Replace("\\", "");
+ msg4 = msg4.Replace("\n", ""); //\n
+ //msg2 = msg2.Replace("'", "鈥�");
+ List<Models.ClsSb_EquipMaintainRuleBillSub> ls1 = new List<Models.ClsSb_EquipMaintainRuleBillSub>();
+ ls1 = oListModels.getObjectByJson_Sb_EquipMaintainRuleBillSub(msg4);
+ int j = 0;
+ foreach (Models.ClsSb_EquipMaintainRuleBillSub oItemSub in ls1)
+ {
+
+ j++;
+ oItemSub.HEntryID = j;
+ //oItemSub.HCloseMan = ""; //琛屽叧闂�
+ oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+ oItemSub.HCloseType = false; //鍏抽棴绫诲瀷
+
+ oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮�
+ oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮�
+
+ oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺
+ oBill.DetailColl_Mater.Add(oItemSub);
+ }
+
+
+ //淇濆瓨
+ //淇濆瓨瀹屾瘯鍚庡鐞�
+ bool bResult;
+ if (oBill.omodel.HInterID == 0)
+ {
+ // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ else
+ {
+ bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ if (bResult)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ #endregion
}
}
--
Gitblit v1.9.1