From 2ee2e1bb7f94b048925b8f898f3b4e9529d48f75 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期一, 25 三月 2024 13:19:13 +0800
Subject: [PATCH] 固定资产变动单
---
WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs | 332 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 315 insertions(+), 17 deletions(-)
diff --git a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
index 0f1321a..830ec93 100644
--- a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
@@ -1,4 +1,5 @@
锘縰sing DBUtility;
+using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -45,8 +46,9 @@
string UserName = sArray[1].ToString();
string refSav = sArray[2].ToString();
DBUtility.ClsPub.CurUserName = UserName;
+
//淇濆瓨鏉冮檺
- if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Edit", 1, true, DBUtility.ClsPub.CurUserName))
+ if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Edit", 1, false, DBUtility.ClsPub.CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -54,6 +56,7 @@
objJsonResult.data = null;
return objJsonResult;
}
+
//鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
string s = "";
int sYear = 0;
@@ -127,10 +130,11 @@
}
DBUtility.ClsPub.CurUserName = oItem.HMaker;
- oItem.HBillType = "3787";
- oItem.HBillSubType = "3787";
+ oItem.HBillType = "4502";
+ oItem.HBillSubType = "4502";
oItem.HBillStatus = 1; //鍗曟嵁鐘舵�侊紙1鏈锛�2瀹℃牳閫氳繃锛�3鍏抽棴锛�4浣滃簾锛�5瀹℃牳閫�鍥�,6瀹℃牳涓�,7宸查槄锛�8宸插洖澶嶏紝9缁撴锛�10楠岃瘉,11涓嬭揪锛�12寮�宸�,13鐢宠瀹℃壒,15鐢宠妫�楠岋紝16 鍒ゅ畾鍚堟牸锛�17鍒ゅ畾涓嶅悎鏍硷級
oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+ oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
{
@@ -140,14 +144,24 @@
objJsonResult.data = 1;
return objJsonResult;
}
- string[] arrStr = oItem.HCopyMan.Split(',');
-
- //鎺ユ敹浜鸿〃浣撴暟鎹�
+
+ //string[] arrStr = oItem.HSendMan.Split(','); //鍙戦�佷汉
+ //arrStr = oItem.HReceiveMan.Split(','); //鎺ユ敹浜�
+ string[] arrStr = oItem.HCopyMan.Split(','); //鎶勯�佷汉
+ List<string> b = new List<string>(arrStr);
+ b.Add(oItem.HSendMan);
+ b.Add(oItem.HReceiveMan);
+ arrStr = b.ToArray();
+ //鎶勯�佷汉琛ㄤ綋鏁版嵁
for (int i = 1; i <= arrStr.Length; i++)
{
Models.ClsOA_ErrMsgBackBillSub2 sb = new Models.ClsOA_ErrMsgBackBillSub2();
sb.HEntryID = i;
sb.HReceiveMan = arrStr[i - 1];
+ if (arrStr[i-1].ToString() == oItem.HSendMan)
+ {
+ sb.HReadFlag = true;
+ }
oBill.DetailColl2.Add(sb);
}
oBill.omodel = oItem;
@@ -231,7 +245,7 @@
try
{
//瀹℃牳鏉冮檺
- if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, true, CurUserName))
+ if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -361,23 +375,44 @@
{
try
{
- ds = Get_TransFerBillList(sWhere);
- if (ds == null)
+ List<object> columnNameList = new List<object>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackBill_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�";
- objJsonResult.data = ds.Tables[0];
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
return objJsonResult;
+ }
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ string sql = "select * from h_v_OA_ErrMsgBackBillList order by 鍗曟嵁鍙� desc";
+ ds = oCN.RunProcReturn(sql, "p_v_OA_ErrMsgBackBillList");
}
else
{
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
- objJsonResult.data = ds.Tables[0];
- return objJsonResult;
+ string sql1 = "select * from h_v_OA_ErrMsgBackBillList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+ ds = oCN.RunProcReturn(sql, "p_v_OA_ErrMsgBackBillList");
}
+
+ //娣诲姞鍒楀悕
+ 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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
}
catch (Exception ex)
{
@@ -400,7 +435,7 @@
A.HSourceInterID,A.HSourceEntryID,A.HSourceBillNo,A.HSourceBillType
from OA_ErrMsgBackBillMain A
inner join OA_ErrMsgBackBillSub2 B on A.HInterID=B.HInterID
- left join Gy_Department D on A.HDeptID=D.HItemID where 1=1 " + sWhere + "");
+ left join Gy_Department D on A.HDeptID=D.HItemID where 1=1 " + sWhere + " order by HItemID desc ");
return new SQLHelper.ClsCN().RunProcReturn(sql, "OA_ErrMsgBackBillMain");
}
@@ -448,5 +483,268 @@
return objJsonResult; ;
}
#endregion
+
+ #region [妯″叿鏀瑰埗鐢宠鍗曞垹闄ゅ姛鑳絔
+ /// <summary>
+ /// 妯″叿鏀瑰埗鐢宠鍗曞垹闄ゅ姛鑳�
+ /// </summary>
+ /// <returns></returns>
+ [Route("Sc_MESTransFerWorkBill/Get_DeleteTransFerBill")]
+ [HttpGet]
+ public object Get_DeleteTransFerBill(string HInterID,string HEntryID, string user)
+ {
+ //缂栬緫鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Delete", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ string s = "";
+ Int64 lngBillKey = 0;
+ try
+ {
+ lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+ if (lngBillKey == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ DLL.ClsOA_ErrMsgBackBill oBill = new DLL.ClsOA_ErrMsgBackBill();
+ if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ if (oBill.omodel.HBillStatus > 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (!DBUtility.Xt_BaseBillFun.Fun_AllowDeleteBill(oBill, ref s))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = s;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ bool IsDete = oBill.DeleteBill(lngBillKey, HEntryID, ref DBUtility.ClsPub.sExeReturnInfo);
+ if (IsDete)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ 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 = e.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ }
+
+ #endregion
+
+ #region 鎶ュ伐骞冲彴寮傚父鍙嶉鍗曞洖澶�
+ /// <summary>
+ /// 寮傚父鍙嶉鍗�
+ /// </summary>
+ /// <param name="msg"></param>
+ /// <returns></returns>
+ [Route("Sc_MESTransFerWorkBill/ReplyMESTransFerWorkFrom")]
+ [HttpPost]
+ public object ReplyMESTransFerWorkFrom([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 UserName = sArray[1].ToString();
+ string refSav = sArray[2].ToString();
+ DBUtility.ClsPub.CurUserName = UserName;
+
+ //淇濆瓨鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Edit", 1, false, DBUtility.ClsPub.CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = s;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ListModels oListModels = new ListModels();
+ try
+ {
+ DLL.ClsOA_ErrMsgBackBill oBill = new DLL.ClsOA_ErrMsgBackBill();
+ List<Models.ClsOA_ErrMsgBackBillSub> lsmain = new List<Models.ClsOA_ErrMsgBackBillSub>();
+ msg2 = msg2.Replace("\\", "");
+ msg2 = msg2.Replace("\n", ""); //\n
+ lsmain = oListModels.getObjectByJson_Gy_MESTransFerWorkBillSub(msg2);
+
+ foreach (Models.ClsOA_ErrMsgBackBillSub DetailReply in lsmain)
+ {
+ oBill.DetailReply = DetailReply;
+ }
+
+ //淇濆瓨
+ //淇濆瓨瀹屾瘯鍚庡鐞�
+ bool bResult;
+
+ if (oBill.DetailReply.HInterID != 0)
+ {
+ bResult = oBill.ReplyBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ else
+ {
+ bResult = false;
+ }
+
+ if (bResult)
+ {
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍥炲鎴愬姛锛�";
+ 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.Message;
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 寮傚父鍙嶉鍒楄〃鍥炲鑾峰彇鏁版嵁
+ [Route("Sc_MESTransFerWorkBill/Get_TransFerReplyBill")]
+ [HttpGet]
+ public object Get_TransFerReplyBill(string sWhere, string user)
+ {
+ try
+ {
+
+ string sql1 = "select * from h_v_OA_ErrMsgBackBillSubList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by HInterID desc";
+ ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackBillSubList");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 寮傚父鍙嶉鍒楄〃鍥炲鏇存敼鐘舵��
+ [Route("Sc_MESTransFerWorkBill/Update_TransFerReplyBill")]
+ [HttpGet]
+ public object Update_TransFerReplyBill(Int64 HInterID, string HEntryID,Int64 Type)
+ {
+ try
+ {
+ string sql = "";
+ switch (Type)
+ {
+ case 9:
+ sql = "update OA_ErrMsgBackBillSub set HSendStatus = 9 where HInterID = " + HInterID + " and HEntryID in (" + HEntryID + ")";
+ break;
+ case 10:
+ sql = "update OA_ErrMsgBackBillSub set HSendStatus = 10 where HInterID = " + HInterID + " and HEntryID in (" + HEntryID + ")";
+ break;
+ }
+
+ oCN.RunProc(sql);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
}
}
\ No newline at end of file
--
Gitblit v1.9.1