From aa51348d3501aa3a9bbda287929f3c8a05825063 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期三, 03 十二月 2025 18:14:31 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs | 604 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 572 insertions(+), 32 deletions(-)
diff --git a/WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs
index 999c60d..9bd958b 100644
--- a/WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs
+++ b/WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs
@@ -40,7 +40,7 @@
return objJsonResult;
}
- ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldUpperBillList where 1=1" + sWhere + "order by hmainid desc ", "h_v_Qj_Sc_MouldUpperBillList");
+ ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldUpperBill_Edit where 1=1" + sWhere + "order by hmainid desc ", "h_v_Qj_Sc_MouldUpperBill_Edit");
//娣诲姞鍒楀悕
foreach (DataColumn col in ds.Tables[0].Columns)
@@ -328,10 +328,10 @@
oCN.RunProc(@"Insert Into Sc_MouldUpperBillSub
(HInterID, HBillNo_bak, HEntryID, HMouldID, HQty
- , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo)
+ , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo,HScanDate,HBarCode)
values("
+ HInterID + ",'"+ HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty
- + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString()+",'"+ oSub.HICMOBillNo.ToString() +
+ + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString()+",'"+ oSub.HICMOBillNo.ToString() + "','getdate()','" + oSub.HBarCode.ToString() +
"') ");
}
@@ -439,11 +439,59 @@
return objJsonResult;
}
+ BillOld.MvarItemKey = "Sc_MouldUpperBillMain";
+ //鍒犻櫎鍓嶆帶鍒�=========================================
+ DataSet ds2;
+ string sql1 = "exec h_p_Sc_MouldUpperBill_BeforeDelCtrl " + Convert.ToInt32(hmainid) + ",'" + ds.Tables[0].Rows[0]["HBillNo"] + "','" + user + "'";
+ ds2 = oCN.RunProcReturn(sql1, "h_p_Sc_MouldUpperBill_BeforeDelCtrl");
+ if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //==================================================================================
+
if (ds.Tables[0].Rows.Count == 1) {
oCN.RunProc("delete from Sc_MouldUpperBillMain where HInterID=" + hmainid);
}
oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID=" + hmainid + " and HEntryID=" + hsubid);
+
+ //鍒犻櫎鍚庢帶鍒�=========================================
+ string sql2 = "exec h_p_Sc_MouldUpperBill_AfterDelCtrl " + Convert.ToInt32(hmainid) + ",'" + ds.Tables[0].Rows[0]["HBillNo"] + "','" + user + "'";
+ ds2 = oCN.RunProcReturn(sql2, "h_p_Sc_MouldUpperBill_AfterDelCtrl");
+ if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //==================================================================================
oCN.Commit();
}
@@ -501,6 +549,7 @@
{
//鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
DataSet ds;
+ DataSet ds2;
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
@@ -514,15 +563,38 @@
return objJsonResult;
}
- //瀹℃牳鍗曟嵁
- if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ //瀹℃牳鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Sc_MouldUpperBill_BeforeCheckCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"] + "','" + user + "'";
+ ds2 = oCN.RunProcReturn(sql1, "h_p_Sc_MouldUpperBill_BeforeCheckCtrl");
+ if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+
+ if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ //==================================================================================
+
+ if (!BillOld.CheckBill(int.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Sc_MouldUpperBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
objJsonResult.data = null;
return objJsonResult;
- }
+ }
}
else
{
@@ -532,13 +604,12 @@
objJsonResult.data = null;
return objJsonResult;
}
-
-
}
else
{
//鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
DataSet ds;
+ DataSet ds2;
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
@@ -552,19 +623,36 @@
return objJsonResult;
}
- //鍙嶅鏍稿崟鎹�
- if (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ //鍙嶅鏍稿墠鎺у埗=========================================
+ string sql1 = "exec h_p_Sc_MouldUpperBill_BeforeUnCheckCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"] + "','" + user + "'";
+ ds2 = oCN.RunProcReturn(sql1, "h_p_Sc_MouldUpperBill_BeforeUnCheckCtrl");
+ if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
{
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+ objJsonResult.data = null;
+ return objJsonResult;
}
- else
+ if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //===========================================================
+
+ if (!BillOld.AbandonCheck(int.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Sc_MouldUpperBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
objJsonResult.data = null;
return objJsonResult;
- }
+ }
}
else
@@ -632,6 +720,7 @@
{
//鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
DataSet ds;
+ DataSet ds2;
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
if (ds == null || ds.Tables[0].Rows.Count == 0)
@@ -653,7 +742,6 @@
return objJsonResult;
}
-
if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
{
objJsonResult.code = "0";
@@ -662,12 +750,43 @@
objJsonResult.data = null;
return objJsonResult;
}
- //鍏抽棴鍗曟嵁
- if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+
+ //鍏抽棴鍓嶆帶鍒�===============================================Begin===================================================================
+ sql = "exec h_p_Sc_MouldUpperBill_BeforeCloseCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"] + "','" + user + "'";
+ ds2 = oCN.RunProcReturn(sql, "h_p_Sc_MouldUpperBill_BeforeCloseCtrl");
+ if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:鍏抽棴鍓嶅墠鍒ゆ柇澶辫触锛屾棤杩斿洖淇℃伅锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ }
+ if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍏抽棴鍓嶆帶鍒�===============================================End===================================================================
+
+ //鍏抽棴鎻愪氦
+ if (BillOld.CloseBill(Convert.ToInt32(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Sc_MouldUpperBill_AfterCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ objJsonResult.code = "1";
objJsonResult.count = 1;
- objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.Message = "鍏抽棴鎴愬姛";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
objJsonResult.data = null;
return objJsonResult;
}
@@ -677,6 +796,7 @@
{
//鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂�
DataSet ds;
+ DataSet ds2;
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
@@ -698,15 +818,46 @@
objJsonResult.data = null;
return objJsonResult;
}
- //鍙嶅叧闂崟鎹�
- if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+
+ //鍙嶅叧闂墠鎺у埗===============================================Begin===================================================================
+ sql = "exec h_p_Sc_MouldUpperBill_BeforeUnCloseCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"] + "','" + user + "'";
+ ds2 = oCN.RunProcReturn(sql, "h_p_Sc_MouldUpperBill_BeforeUnCloseCtrl");
+ if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
- objJsonResult.count = 1;
- objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:鍙嶅叧闂墠鍓嶅垽鏂け璐ワ紝鏃犺繑鍥炰俊鎭紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ }
+ if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
return objJsonResult;
}
+ //鍙嶅叧闂墠鎺у埗===============================================End===================================================================
+
+ //鍙嶅叧闂彁浜�
+ if (BillOld.CancelClose(Convert.ToInt32(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Sc_MouldUpperBill_AfterUnCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
}
}
@@ -879,7 +1030,7 @@
return objJsonResult;
}
- ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldLowerBillList where 1=1" + sWhere + "order by hmainid desc ", "h_v_Qj_Sc_MouldLowerBillList");
+ ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldLowerBill_Edit where 1=1" + sWhere + "order by hmainid desc ", "h_v_Qj_Sc_MouldLowerBill_Edit");
//娣诲姞鍒楀悕
foreach (DataColumn col in ds.Tables[0].Columns)
@@ -1278,12 +1429,60 @@
return objJsonResult;
}
+ BillOld.MvarItemKey = "Sc_MouldLowerBillMain";
+ //鍒犻櫎鍓嶆帶鍒�=========================================
+ DataSet ds2;
+ string sql1 = "exec h_p_Sc_MouldLowerBill_BeforeDelCtrl " + Convert.ToInt32(hmainid) + ",'" + ds.Tables[0].Rows[0]["HBillNo"] + "','" + user + "'";
+ ds2 = oCN.RunProcReturn(sql1, "h_p_Sc_MouldLowerBill_BeforeDelCtrl");
+ if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //==================================================================================
+
if (ds.Tables[0].Rows.Count == 1)
{
oCN.RunProc("delete from Sc_MouldLowerBillMain where HInterID=" + hmainid);
}
oCN.RunProc("delete from Sc_MouldLowerBillSub where HInterID=" + hmainid + " and HEntryID=" + hsubid);
+
+ //鍒犻櫎鍚庢帶鍒�=========================================
+ string sql2 = "exec h_p_Sc_MouldLowerBill_AfterDelCtrl " + Convert.ToInt32(hmainid) + ",'" + ds.Tables[0].Rows[0]["HBillNo"] + "','" + user + "'";
+ ds2 = oCN.RunProcReturn(sql2, "h_p_Sc_MouldLowerBill_AfterDelCtrl");
+ if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //==================================================================================
oCN.Commit();
}
@@ -1341,6 +1540,7 @@
{
//鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
DataSet ds;
+ DataSet ds2;
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
@@ -1354,8 +1554,31 @@
return objJsonResult;
}
- //瀹℃牳鍗曟嵁
- if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ //瀹℃牳鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Sc_MouldLowerBill_BeforeCheckCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"] + "','" + user + "'";
+ ds2 = oCN.RunProcReturn(sql1, "h_p_Sc_MouldLowerBill_BeforeCheckCtrl");
+ if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+
+ if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ //==================================================================================
+
+ if (!BillOld.CheckBill(int.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Sc_MouldLowerBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
{
objJsonResult.code = "0";
objJsonResult.count = 1;
@@ -1376,6 +1599,7 @@
{
//鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
DataSet ds;
+ DataSet ds2;
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
@@ -1389,12 +1613,29 @@
return objJsonResult;
}
- //鍙嶅鏍稿崟鎹�
- if (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ //鍙嶅鏍稿墠鎺у埗=========================================
+ string sql1 = "exec h_p_Sc_MouldLowerBill_BeforeUnCheckCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"] + "','" + user + "'";
+ ds2 = oCN.RunProcReturn(sql1, "h_p_Sc_MouldLowerBill_BeforeUnCheckCtrl");
+ if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
{
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+ objJsonResult.data = null;
+ return objJsonResult;
}
- else
+ if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //===========================================================
+
+ if (!BillOld.AbandonCheck(int.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Sc_MouldLowerBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
{
objJsonResult.code = "0";
objJsonResult.count = 1;
@@ -1468,6 +1709,7 @@
{
//鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
DataSet ds;
+ DataSet ds2;
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
if (ds == null || ds.Tables[0].Rows.Count == 0)
@@ -1498,12 +1740,43 @@
objJsonResult.data = null;
return objJsonResult;
}
- //鍏抽棴鍗曟嵁
- if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+
+ //鍏抽棴鍓嶆帶鍒�===============================================Begin===================================================================
+ sql = "exec h_p_Sc_MouldLowerBill_BeforeCloseCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"] + "','" + user + "'";
+ ds2 = oCN.RunProcReturn(sql, "h_p_Sc_MouldLowerBill_BeforeCloseCtrl");
+ if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:鍏抽棴鍓嶅墠鍒ゆ柇澶辫触锛屾棤杩斿洖淇℃伅锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ }
+ if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍏抽棴鍓嶆帶鍒�===============================================End===================================================================
+
+ //鍏抽棴鎻愪氦
+ if (BillOld.CloseBill(Convert.ToInt32(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Sc_MouldLowerBill_AfterCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ objJsonResult.code = "1";
objJsonResult.count = 1;
- objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.Message = "鍏抽棴鎴愬姛";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
objJsonResult.data = null;
return objJsonResult;
}
@@ -1513,6 +1786,7 @@
{
//鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂�
DataSet ds;
+ DataSet ds2;
string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
@@ -1534,12 +1808,43 @@
objJsonResult.data = null;
return objJsonResult;
}
- //鍙嶅叧闂崟鎹�
- if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+
+ //鍙嶅叧闂墠鎺у埗===============================================Begin===================================================================
+ sql = "exec h_p_Sc_MouldLowerBill_BeforeUnCloseCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"] + "','" + user + "'";
+ ds2 = oCN.RunProcReturn(sql, "h_p_Sc_MouldLowerBill_BeforeUnCloseCtrl");
+ if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:鍙嶅叧闂墠鍓嶅垽鏂け璐ワ紝鏃犺繑鍥炰俊鎭紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ }
+ if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍙嶅叧闂墠鎺у埗===============================================End===================================================================
+
+ //鍙嶅叧闂彁浜�
+ if (BillOld.CancelClose(Convert.ToInt32(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Sc_MouldLowerBill_AfterUnCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ objJsonResult.code = "1";
objJsonResult.count = 1;
- objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
objJsonResult.data = null;
return objJsonResult;
}
@@ -2166,5 +2471,240 @@
}
#endregion
+
+ #region 涓婃ā鍗� APP鏂板
+ /// <summary>
+ /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Sc_MouldUpperBill/AddSc_MouldUpperBill_APP")]
+ [HttpPost]
+ public object AddSc_MouldUpperBill_APP([FromBody] JObject sMainSub)
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddBillMain_APP(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 = ds.Tables[0];
+ return objJsonResult;
+ }
+
+ public json AddBillMain_APP(string msg1)
+ {
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString();
+ int OperationType = int.Parse(sArray[2].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+ string user = sArray[3].ToString();//鐢ㄦ埛鍚�
+ try
+ {
+ if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愮紪杈�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ msg2 = "[" + msg2.ToString() + "]";
+ List<ClsSc_MouldUpperBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillMain>>(msg2);
+ string HBillType = "3846";
+ long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
+ string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
+ DateTime HDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));//鏃ユ湡
+ int HYear = DateTime.Now.Year;
+ double HPeriod = DateTime.Now.Month;
+ string HRemark = mainList[0].HRemark;//澶囨敞
+ string HMaker = mainList[0].HMaker;//鍒跺崟浜�
+ int HOrgID = mainList[0].HOrgID; //缁勭粐
+ Int64 HDeptID = mainList[0].HDeptID;
+ Int64 HEmpID = mainList[0].HEmpID;
+ Int64 HMangerID = mainList[0].HMangerID;
+
+ ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldUpperBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_Qj_Sc_MouldUpperBillList");
+
+ if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//鏂板
+ {
+ //淇濆瓨鍓嶆帶鍒�
+ objJsonResult = BeforeSave_MouldUpperBill(HInterID, HBillNo, 1);
+ if (objJsonResult.count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //涓昏〃
+ oCN.RunProc(@"Insert Into Sc_MouldUpperBillMain
+ (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate
+ , HYear, HPeriod, HRemark, HMaker, HMakeDate, HOrgID
+ , HDeptID, HEmpID, HMangerID)" +
+ " values('" + HBillType + "','1','" + HBillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
+ "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()," + HOrgID +
+ "," + HDeptID + "," + HEmpID + "," + HMangerID + ") ");
+
+ }
+ else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
+ {
+ //淇濆瓨鍓嶆帶鍒�
+ objJsonResult = BeforeSave_MouldUpperBill(HInterID, HBillNo, 2);
+ if (objJsonResult.count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //淇敼
+ oCN.RunProc("update Sc_MouldUpperBillMain set " +
+ "HDate='" + HDate +
+ "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker +
+ "',hupdatedate=getdate(),HDeptID=" + HDeptID + ",HEmpID=" + HEmpID + ",HMangerID=" + HMangerID + " where HInterID='" + HInterID + "'");
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID='" + HInterID + "'");
+ }
+ //淇濆瓨瀛愯〃
+ objJsonResult = AddBillSub_APP(msg3, HInterID, HBillNo, OperationType);
+ if (objJsonResult.code == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ public json AddBillSub_APP(string msg3, long HInterID, string HBillNo, Int64 OperationType)
+ {
+ List<ClsSc_MouldUpperBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillSub>>(msg3);
+ int i = 0;
+ foreach (ClsSc_MouldUpperBillSub oSub in DetailColl)
+ {
+ i++;
+
+ oCN.RunProc(@"Insert Into Sc_MouldUpperBillSub
+ (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty
+ , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo,HScanDate,HBarCode)
+ values("
+ + HInterID + ",'" + HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty
+ + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString() + "',getdate(),'" + oSub.HBarCode.ToString() +
+ "') ");
+ }
+
+ if (OperationType == 1)//鏂板
+ {
+ //淇濆瓨鍚庢帶鍒�
+ objJsonResult = AfterSave_MouldUpperBill(HInterID, HBillNo, 1);
+ if (objJsonResult.count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ //淇濆瓨鍚庢帶鍒�
+ objJsonResult = AfterSave_MouldUpperBill(HInterID, HBillNo, 2);
+ if (objJsonResult.count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ #endregion
+
+ #region 涓婃ā鍗曟壂鎻忔潯鐮佹煡璇㈡槸鍚﹀瓨鍦� 骞舵牎楠屼骇鍝侀槻閿欎俊鎭�
+ [Route("Sc_MouldUpperBill/GetBarCode_FC")]
+ [HttpGet]
+ public object GetBarCode_FC(string HBarCode, int HMaterID)
+ {
+ try
+ {
+
+ ds = oCN.RunProcReturn("exec h_p_Sc_MouldFill_Verification '" + HBarCode + "','" + HMaterID + "'", "h_p_Sc_MouldFill_Verification");
+
+ 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.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0; //澶辫触锛�
+ objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1; //鎴愬姛锛�
+ objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+ objJsonResult.data = null;
+ 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