From 1f49f98a07ae1c31a1967c5c36b382d6c855becd Mon Sep 17 00:00:00 2001
From: jhz <jinghz@oceic.com>
Date: 星期二, 26 七月 2022 09:59:37 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/Sc_MouldOtherInBillController.cs | 674 +++++++++++++++++++++++++++-----------------------------
1 files changed, 325 insertions(+), 349 deletions(-)
diff --git a/WebAPI/Controllers/Sc_MouldOtherInBillController.cs b/WebAPI/Controllers/Sc_MouldOtherInBillController.cs
index 4b5a1f4..e053b18 100644
--- a/WebAPI/Controllers/Sc_MouldOtherInBillController.cs
+++ b/WebAPI/Controllers/Sc_MouldOtherInBillController.cs
@@ -1,10 +1,10 @@
锘縰sing Newtonsoft.Json.Linq;
+using Pub_Class;
using System;
using System.Collections.Generic;
using System.Data;
using System.Web.Http;
using WebAPI.Models;
-using Pub_Class;
namespace WebAPI.Controllers
{
/**
@@ -12,27 +12,93 @@
*/
public class Sc_MouldOtherInBillController : ApiController
{
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+
private json objJsonResult = new json();
- DataSet ds;
+ public DataSet ds = new DataSet();
public WebServer webserver = new WebServer();
- SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+ public DAL.ClsSc_MouldScrapInBill BillNew0 = new DAL.ClsSc_MouldScrapInBill(); //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫�
+ public DAL.ClsSc_MouldScrapInBill BillOld0 = new DAL.ClsSc_MouldScrapInBill(); //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫�
+
/// <summary>
/// 鏍规嵁鍖呰鍗� 杩斿洖姝ゅ寘瑁呭崟鍐呯殑鐩稿叧淇℃伅
/// </summary>
/// <returns></returns>
- ///
- #region 妯″叿鍏朵粬鍏ュ簱鍗曞垪琛�
-
- [Route("Sc_MouldOtherInBill/GetMouldOtherInBillList")]
+ /// <summary>
+ /// 妫�鍏风淮淇伐鍗曞垪琛�
+ /// </summary>
+ /// <returns></returns>
+ [Route("Sc_CheckToolsRepair/GetCheckToolsRepairWorkBillList")]
[HttpGet]
- public object GetMouldProdOutBill(string sWhere)
+ public object GetCheckToolsRepairWorkBillList(string sWhere)
{
try
{
- ds = Sc_MouldOtherInBillList_s(sWhere);
+ ds = Sc_CheckToolsRepairWorkBillList_s(sWhere);
+ 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;
+ }
+ }
+ catch (Exception ex)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ #region sql璇彞
+
+
+ public static DataSet Sc_CheckToolsRepairWorkBillList_s(string sWhere)
+ {
+ return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_CheckToolsRepairWorkBillList ", "h_v_Sc_CheckToolsRepairWorkBillList");
+ }
+
+
+
+
+ #region 鍏朵粬鍏ュ簱鍗�
+
+ #region 鍏朵粬鍏ュ簱鍗曞垪琛�
+
+ [Route("Sc_MouldOtherInBill/GetMouldOtherInBill")]
+ [HttpGet]
+ public object GetMouldOtherInBill(string sWhere,string user, string Organization)
+ {
+ try
+ {
+ //缂栬緫鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Sc_MouldOtherInBillList", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = Sc_MouldOtherInBill(sWhere, Organization);
+
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
@@ -49,209 +115,274 @@
}
}
- public static DataSet Sc_GetMouldProdOutBill(string sWhere)
+ public static DataSet Sc_MouldOtherInBill(string sWhere, string Organization)
{
+ string sql1 = string.Format(@"select * from h_v_Sc_MouldOtherInBillList where 搴撳瓨缁勭粐='" + Organization + "'");
if (sWhere == null || sWhere.Equals(""))
{
- return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldOtherInBillList ", "h_v_Sc_MouldOtherInBillList");
+ return new SQLHelper.ClsCN().RunProcReturn(sql1 + "order by hmainid desc", "h_v_Sc_MouldOtherInBillList");
}
else
{
- string sql1 = "select * from h_v_Sc_MouldOtherInBillList where 1 = 1 ";
- string sql = sql1 + sWhere;
+ string sql = sql1 + sWhere+ "order by hmainid desc";
return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldOtherInBillList");
}
}
+
#endregion
- ///// <summary>
- ///// 杩斿洖妯″叿鍏朵粬鍏ュ簱鍗曞垪琛�
- /////鍙傛暟锛歴tring sql銆�
- /////杩斿洖鍊硷細object銆�
- ///// </summary>
- //[Route("Sc_MouldOtherInBill/GetMouldOtherInBillList")]
- //[HttpGet]
- //public object list(string sWhere)
- //{
- // try
- // {
- // if (sWhere == null || sWhere.Equals(""))
- // {
- // ds = oCN.RunProcReturn("select * from Sc_MouldStockBillMain " + sWhere, "Sc_MouldStockBillMain");
- // }
- // else
- // {
- // string sql1 = "select * from Sc_MouldStockBillMain where 1 = 1 ";
- // string sql = sql1 + sWhere;
- // ds = oCN.RunProcReturn(sql, "Sc_MouldStockBillMain");
- // }
- // if (ds == null || ds.Tables[0].Rows.Count == 0)
- // {
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "false锛�";
- // objJsonResult.data = null;
- // return objJsonResult;
- // }
- // else
- // {
- // 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;
- // }
- //}
- ///// <summary>
- ///// 妯″叿鍏朵粬鍏ュ簱鍗曞垪琛�
- ///// </summary>
- ///// <returns></returns>
- //[Route("Sc_MouldOtherInBill/GetMouldOtherInBillList")]
- //[HttpGet]
- //public object GetMouldOtherInBillList(string sWhere)
- //{
- // try
- // {
- // ds = Sc_MouldOtherInBillList_s(sWhere);
- // 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;
- // }
- // }
- // catch (Exception ex)
- // {
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
- // objJsonResult.data = null;
- // return objJsonResult;
- // }
- //}
-
- #region sql璇彞
-
-
- public static DataSet Sc_MouldOtherInBillList_s(string sWhere)
+ #region[鍣ㄥ叿鍏朵粬鍏ュ簱鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁]
+ [Route("Sc_MouldOtherInBill/Sc_MouldOtherInBillListCheckDetai")]
+ [HttpGet]
+ public ApiResult<DataSet> Sc_MouldOtherInBillListCheckDetai(string HID)
{
- return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldOtherInBillList ", "h_v_Sc_MouldOtherInBillList");
+ 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 h_v_Sc_MouldOtherInBillList where hmainid= " + HID + " ", "h_v_Sc_MouldOtherInBillList");
+ 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
- /// <summary>
- /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
- [Route("Sc_MouldOtherInBill/AddBill1")]
- [HttpPost]
- public object AddBill1([FromBody] JObject oMain)
+ #region[鍣ㄥ叿鍏朵粬鍏ュ簱鍗曠紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁]
+ [Route("Sc_MouldOtherInBill/Sc_MouldOtherInBillListProjectDetai")]
+ [HttpGet]
+ public object Sc_MouldOtherInBillListProjectDetai(string sqlWhere)
{
-
+ DataSet ds;
+ DataSet ds1;
+ List<object> list = new List<object>();
try
{
- DAL.ClsSc_MouldOtherInBill oMould = new DAL.ClsSc_MouldOtherInBill();
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ if (sqlWhere == null || sqlWhere.Equals(""))
+ {
+ ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,鎵规 HBatchNo,
+ 璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 绱Н浣跨敤瀵垮懡 HUseLife, 搴斿彂鏁伴噺 HQtyMust, 瀹炲彂鏁伴噺 HQty,
+ 鍗曚环 HPrice, 閲戦 HMoney,鏀舵枡浠撳簱ID HWHID, 鏀舵枡浠撳簱浠g爜 HWHCode, 鏀舵枡浠撳簱 HWHName,HSPID,
+ 浠撲綅浠g爜 HSPCode, 浠撲綅 HSPName,琛ㄤ綋澶囨敞 HRemark,HStockOrgID FROM h_v_Sc_MouldOtherInBillList"), "h_v_Sc_MouldOtherInBillList");
- var _value = oMain["oMain"].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();
- //鍙嶅簭鍒楀寲
- msg2 = "[" + msg2.ToString() + "]";
- List<Sc_MouldStockBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_MouldStockBillMain>>(msg2);
+ }
+ else
+ {
+ //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 ";
+ string sql1 = string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,鎵规 HBatchNo,
+ 璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 绱Н浣跨敤瀵垮懡 HUseLife, 搴斿彂鏁伴噺 HQtyMust, 瀹炲彂鏁伴噺 HQty,
+ 鍗曚环 HPrice, 閲戦 HMoney,鏀舵枡浠撳簱ID HWHID, 鏀舵枡浠撳簱浠g爜 HWHCode, 鏀舵枡浠撳簱 HWHName,HSPID,
+ 浠撲綅浠g爜 HSPCode, 浠撲綅 HSPName,琛ㄤ綋澶囨敞 HRemark,HStockOrgID FROM h_v_Sc_MouldOtherInBillList where 1 = 1 ");
+ string sql = sql1 + sqlWhere;
+ ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldOtherInBillList");
- long HItemID = list[0].HInterID;
- string HBillNo = list[0].HBillNo;
- DateTime HDate = list[0].HDate;
- long HSCWHID = list[0].HSCWHID;
- long HWHID = list[0].HWHID;
- long HSupID = list[0].HSupID;
- long HSecManagerID = list[0].HSecManagerID;
- long HRepairID = list[0].HRepairID;
- long HManagerID = list[0].HManagerID;
- string HUpDater = list[0].HUpDater;
- long HDeptID = list[0].HDeptID;
+ }
+ //鏌ユ眹鎬�
+ ds1 = oCN.RunProcReturn(string.Format(@"select 鐗╂枡浠g爜,max(鐗╂枡鍚嶇О)鐗╂枡鍚嶇О,瑙勬牸鍨嬪彿,max(鍗曟嵁鍙�)鍗曟嵁鍙�,鎵规,sum(瀹炲彂鏁伴噺)瀹炲彂鏁伴噺,
+ 鏀舵枡浠撳簱ID,max(鏀舵枡浠撳簱浠g爜)鏀舵枡浠撳簱浠g爜,max(鏀舵枡浠撳簱)鏀舵枡浠撳簱,琛ㄤ綋澶囨敞 from h_v_Sc_MouldOtherInBillList
+ where 1=1 " + sqlWhere + " group by 鐗╂枡浠g爜,瑙勬牸鍨嬪彿,鏀舵枡浠撳簱ID,鎵规,琛ㄤ綋澶囨敞"), "h_v_Sc_MouldOtherInBillList");
-
-
-
-
-
- //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
- oCN.BeginTran();
- //涓昏〃
- oCN.RunProc("Update Sc_MouldStockBillMain set " +
- " HSCWHID=" + HSCWHID +
- ",HWHID=" + HWHID +
- ",HSupID=" + HSupID +
- ",HSecManagerID=" + HSecManagerID +
- ",HManagerID= " + HManagerID + " Where HInterID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
- //淇敼瀛愰」鐩唬鐮�
- //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_EquipMent,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
- //灏嗕笂绾� 涓洪潪鏈骇
- //oCN.RunProc("Update Gy_EquipMent set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
- //
- oCN.Commit();
- objJsonResult.code = "1";
+ list.Add(ds.Tables[0]);
+ list.Add(ds1.Tables[0]);
+ objJsonResult.code = "0";
objJsonResult.count = 1;
- objJsonResult.Message = "淇敼鍗曟嵁鎴愬姛锛�";
- //objJsonResult.data = null;
- return objJsonResult;
+ objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+ objJsonResult.list = list;
}
catch (Exception e)
{
- oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "Exception锛�" + e.Message;
+ objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
objJsonResult.data = null;
+ }
+ return objJsonResult;
+ }
+ #endregion
+
+ #region 鍣ㄥ叿鍏朵粬鍏ュ簱鍗曚繚瀛�/缂栬緫
+ /// <summary>
+ /// 淇濆瓨妯″叿棰嗙敤鍗�
+ /// </summary>
+ /// <param name="msg"></param>
+ /// <returns></returns>
+ [Route("Sc_MouldOtherInBill/SaveGetMouldOtherInBillList")]
+ [HttpPost]
+ public object SaveGetMouldOtherInBillList([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 UserName = "";
+ ListModels oListModels = new ListModels();
+ try
+ {
+ //缂栬緫鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Sc_MouldOtherInBill_Edit", 1, false, msg4))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ DLL.ClsSc_MouldOtherInBill oBill = new DLL.ClsSc_MouldOtherInBill();
+ List<Model.ClsSc_MouldOtherInBillMain> lsmain = new List<Model.ClsSc_MouldOtherInBillMain>();
+ msg2 = msg2.Replace("\\", "");
+ msg2 = msg2.Replace("\n", ""); //\n
+ lsmain = oListModels.getObjectByJson_Sc_MouldOtherInBillMain(msg2);
+ foreach (Model.ClsSc_MouldOtherInBillMain oItem in lsmain)
+ {
+ //oItem.HMaker = "";
+ UserName = oItem.HMaker; //鍒跺崟浜�
+ oItem.HBillType = "3841";
+ oItem.HBillSubType = "3841";
+ //oItem.HBillNo = ""; //鍗曟嵁鍙�
+ //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡
+ //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙�
+ oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+ oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+ //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent)
+ //oItem.HPeriod = 0;
+ //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡
+ //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�)
+ //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee)
+ //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee)
+ //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department)
+ //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪)
+ //oItem.HRemark = ""; //澶囨敞
+
+ //oItem.HMainSourceInterID = oItem.HInterID;
+
+ //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
+ 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<Model.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>();
+ ls = oListModels.getObjectByJson_Gy_MouldStockBillSub(msg3);
+ int i = 0;
+ foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls)
+ {
+
+ i++;
+ oItemSub.HEntryID = i;
+
+ //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID
+ //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭
+ //oItemSub.HManagerID = 0; //璐熻矗浜篒D
+ //oItemSub.HCloseMan = ""; //琛屽叧闂�
+ oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+ oItemSub.HCloseType = false; //鍏抽棴绫诲瀷
+ //oItemSub.HRemark = ""; //澶囨敞
+ oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮�
+ oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮�
+ //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿
+ //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+ //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺
+ //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦
+ //oItemSub.HRepairID = 0; //缁翠慨椤圭洰
+ //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰
+ //oItemSub.HMoney = 0; //缁翠慨璐圭敤
+ oBill.DetailColl.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)
+ {
+ string sql = $"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' ";
+ oCn.RunProc(sql);
+ 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
-
-
+ #region [鍣ㄥ叿鍏朵粬鍏ュ簱鍗曞垹闄ゅ姛鑳絔
/// <summary>
- /// 妯″叿鍏ュ簱鍗曞垪琛ㄥ垹闄ゆ寜閽�
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
+ /// 妯″叿澶勭悊棰嗙敤鍗曞垹闄ゅ姛鑳�
/// </summary>
- [Route("Sc_MouldOtherInBill/Delete_Json")]
+ /// <returns></returns>
+ [Route("Sc_MouldOtherInBill/DeltetMouldOtherInBill")]
[HttpGet]
- public object Delete_Json(long HItemID)
+ public object DeltetMouldOtherInBill(string HInterID,string user)
{
- DAL.ClsSc_MouldOtherInBill oMould = new DAL.ClsSc_MouldOtherInBill();
- try
+ //缂栬緫鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Sc_MouldOtherOutBill_Delete", 1, false, user))
{
- if (oMould.omodel.HBillStatus > 1)
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ Int64 lngBillKey = 0;
+ lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+ if (lngBillKey == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ DLL.ClsSc_MouldOtherInBill oBill = new DLL.ClsSc_MouldOtherInBill();
+ if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ if (oBill.omodel.HBillStatus > 1)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -259,7 +390,7 @@
objJsonResult.data = null;
return objJsonResult;
}
- if (oMould.omodel.HChecker != "")
+ if (oBill.omodel.HChecker != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -267,195 +398,40 @@
objJsonResult.data = null;
return objJsonResult;
}
- //
- if (oMould.DeleteBill(HItemID, ref DBUtility.ClsPub.sExeReturnInfo))
- {
- ////鍐欏叆鏃ュ織
- //ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oMould.omodel.hn + ",鍚嶇О锛�" + oMould.omodel.HName, ClsPub.CurUserName);
- //鏇存柊涓婄骇涓� 鏈骇
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "鍒犻櫎鎴愬姛";
- objJsonResult.data = null;
- return objJsonResult;
- }
- else
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "鍒犻櫎澶辫触";
- objJsonResult.data = null;
- return objJsonResult;
- }
- //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID = " + HItemID, "Gy_Department");
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- 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;
- }
- }
-
-
-
-
-/// <summary>
-/// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
-///鍙傛暟锛歴tring sql銆�
-///杩斿洖鍊硷細object銆�
-/// </summary>
-[Route("Sc_MouldOtherInBill/AddBill")]
- [HttpPost]
- public object AddBill([FromBody] JObject sMainSub)
- {
- var _value = sMainSub["sMainSub"].ToString();
- string msg1 = _value.ToString();
- oCN.BeginTran();
- //淇濆瓨涓昏〃
- objJsonResult = AddBillMain(msg1);
- if (objJsonResult.code == "0")
- {
- oCN.RollBack();
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = objJsonResult.Message;
- objJsonResult.data = null;
- return objJsonResult;
- }
- oCN.Commit();
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
- objJsonResult.data = null;
- return objJsonResult;
- }
-
- public json AddBillMain(string msg1)
- {
- string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
- string msg2 = sArray[0].ToString();
- string msg3 = sArray[1].ToString();
- try
- {
- msg2 = "[" + msg2.ToString() + "]";
- List<Sc_MouldStockBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_MouldStockBillMain>>(msg2);
- string BillType = "3795";
- long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
- string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
- DateTime HDate = mainList[0].HDate;//鏃ユ湡
- int HYear = 2021;
- double HPeriod = 1;
- string HRemark = mainList[0].HRemark;//澶囨敞
- string HMaker = mainList[0].HMaker;//鍒跺崟浜�
- long HSCWHID = mainList[0].HSCWHID;//
- long HSupID = mainList[0].HSupID;//
- long HEmpID = mainList[0].HEmpID;
- long HManagerID = mainList[0].HManagerID;//
- long HWHID = mainList[0].HWHID;//
- long HProcID = mainList[0].HProcID;//
- long HSecManagerID = mainList[0].HSecManagerID;//
- long HKeeperID = mainList[0].HKeeperID;//
- long HDeptID = mainList[0].HDeptID;
- string HExplanation = mainList[0].HExplanation;//
- string HInnerBillNo = mainList[0].HInnerBillNo;//
- string HRedBlueFlag = mainList[0].HRedBlueFlag;//
- string HRepairType = mainList[0].HRepairType;//
- long HRepairID = mainList[0].HRepairID;//
-
- //涓昏〃
- oCN.RunProc("Insert Into Sc_MouldStockBillMain " +
- "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
- ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
- ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
- ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
- ") " +
- " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
- "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()" +
- "," + HSupID + "," + HWHID + "," + HSCWHID + "," + HEmpID + "," + HManagerID + "," + HSecManagerID +
- "," + HKeeperID + "," + HDeptID + ",'" + HExplanation + "','" + HInnerBillNo + "','" + HRedBlueFlag + "'" +
- ") ");
-
- //淇濆瓨瀛愯〃
- objJsonResult = AddBillSub(msg3, HInterID);
- if (objJsonResult.code == "0")
+ bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ if (IsDete)
{
objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.count = 1;
+ objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
objJsonResult.data = null;
return objJsonResult;
}
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = null;
- objJsonResult.data = null;
- return objJsonResult;
+ else
+ {
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
}
- catch (Exception e)
+ else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.Message = "鍗曟嵁鏈壘鍒�";
objJsonResult.data = null;
return objJsonResult;
}
}
+ #endregion
- public json AddBillSub(string msg3, long HInterID)
- {
- List<Sc_MouldStockBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_MouldStockBillSub>>(msg3);
- for (int i = 0; i < subList.ToArray().Length; i++)
- {
- long HMaterID = 0;//鐗╂枡ID
- long HPropertyID = 0;//
- long HSecUnitID = 0;//
- long HUnitID = 0;//
- long HWHID = 0;//
- long HSCWHID = 0;//
- long HSPID = 0;//
- long HSCSPID = 0;//
- long HSPGroupID = 0;//
- long HLifeUnitID = 0;//
-
- oCN.RunProc("Insert into Sc_MouldStockBillSub " +
- " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
- ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
- ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
- ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
- ",HDesignLife,HLeaveLife,HUseLife,HUseLifeQty" +
- ",HSCSPID,HSPGroupID,HBatchNo" +
- ",HNewModel,HWallThickness,HHardness,HLastProdModel,HDiameter,HBackFlag" +
- ",HQtyRel,HNewLifeQty,HNowModel,HNowLife" +
- ",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" +
- ") values("
- + HInterID + "," + i + ",'','','','" + subList[i].HRemark + "'" +
- "," + subList[i].HSourceInterID + "," + subList[i].HSourceEntryID + ",'" + subList[i].HSourceBillNo + "','" + subList[i].HSourceBillType + "','" + subList[i].HrelationQty + "','" + subList[i].HrelationQty + "'" +
- "," + HMaterID + "," + HPropertyID + "," + HSecUnitID + ",'" + subList[i].HSecUnitRate + "','" + HUnitID + "','" + subList[i].HQtyMust + "'" +
- ",'" + subList[i].HQty + "','" + subList[i].HPrice + "','" + subList[i].HMoney + "'," + HWHID + "," + HSCWHID + "," + HSPID +
- ",'" + subList[i].HDesignLife + "','" + subList[i].HLeaveLife + "','" + subList[i].HUseLife + "','" + subList[i].HUseLifeQty + "'" +
- "," + HSCSPID + "," + HSPGroupID + ",'" + subList[i].HBatchNo + "'" +
- ",'" + subList[i].HNewModel + "','" + subList[i].HWallThickness + "','" + subList[i].HHardness + "','" + subList[i].HLastProdModel + "','" + subList[i].HDiameter + "','" + subList[i].HBackFlag + "'" +
- ",'" + subList[i].HQtyRel + "','" + subList[i].HNewLifeQty + "','" + subList[i].HNowModel + "','" + subList[i].HNowLife + "'" +
- ",'" + subList[i].HMouldType + "','" + subList[i].HInitModel + "','" + subList[i].HInitDesignLife + "'," + HLifeUnitID +
- ") ");
- }
-
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = null;
- objJsonResult.data = null;
- return objJsonResult;
- }
}
-}
\ No newline at end of file
+}
+#endregion
+#endregion
\ No newline at end of file
--
Gitblit v1.9.1