From 25bf838d771f7f1ab2773c58da76df51329e7dcc Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期四, 24 八月 2023 15:00:51 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs | 121 ++++++++++++++++++++++++++++++++++++----
1 files changed, 109 insertions(+), 12 deletions(-)
diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
index 8c8035d..427a570 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
@@ -9,6 +9,7 @@
using System.Data;
using System.Data.SqlClient;
using System.Web.Http;
+using System.Windows.Forms;
using WebAPI.Models;
namespace WebAPI.Controllers
@@ -288,12 +289,12 @@
,HYear,HPeriod,HRemark,HMaker,HMakeDate
,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HEmpID,HCusID
,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate,HBillStatus
- ,HOWNERID)
+ ,HOWNERID,HOWNERTYPEID)
values('3710'," + mainList[0].HInterID + ",'" + mainList[0].HBillNo + "','" + mainList[0].HDate + "'," + mainList[0].HPRDORGID +
"," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + mainList[0].HRemark + "','" + mainList[0].HMaker + "',getdate()" +
",'" + mainList[0].HSeOrderBillNo + "'," + mainList[0].HSeOrderInterID + "," + mainList[0].HSeOrderEntryID + "," + mainList[0].HEmpID + "," + mainList[0].HCusID +
"," + mainList[0].HCenterID + "," + mainList[0].HPlanQty + ",0,0,0,0,'','',2" +
- ","+ mainList[0].HOWNERID + ") ");
+ ","+ mainList[0].HOWNERID + ",'"+ mainList[0].HOWNERTYPEID + "') ");
//淇濆瓨涓昏〃
foreach (var oSub in subList)
{
@@ -307,7 +308,7 @@
values({oSub.HInterID},{oSub.HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)}
,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
- ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},4
+ ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},'{oSub.HSTATUS}'
,0,0,'','',0,0
,{oSub.HCOSTRATE},{oSub.HISBACKFLUSH},'{oSub.HBatchNo}',{oSub.HBomID},{oSub.HCHECKPRODUCT},{oSub.HSEQ},{oSub.HSTOCKINORGID})");
}
@@ -412,6 +413,7 @@
int OperationType = int.Parse(sArray[1].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼
string user = sArray[2].ToString();
int HEntryID = int.Parse(sArray[3].ToString());
+ string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О
try
{
@@ -442,6 +444,9 @@
long HBomID = mainList[0].HBomID;//bom
//double? HPlanQty = mainList[0].HPlanQty == null ? 0 : mainList[0].HPlanQty;//璁″垝鏁伴噺
string HMaker = user;//鍒跺崟浜�
+ string HIsStockQty = mainList[0].HIsStockQty;
+ string HRemark3 = mainList[0].HRemark3;
+
ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_ICMOBillList");
@@ -452,11 +457,17 @@
(HBillType,HBillStatus,HInterID,HBillNo,HDate,HPRDORGID
,HYear,HPeriod,HRemark,HMaker,HMakeDate
,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HEmpID,HCusID
- ,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate)
+ ,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate
+ ,HIsStockQty,HRemark3)
values('3710',1," + HInterID + ",'" + HBillNo + "','" + HDate + "'," + HPRDORGID +
"," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()" +
",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID +
- "," + HCenterID + ",0,0,0,0," + HBomID + ",'','') ");
+ "," + HCenterID + ",0,0,0,0," + HBomID + ",'',''" +
+ ",'"+ HIsStockQty + "','"+ HRemark3 + "') ");
+
+ LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板鐢熶骇璁㈠崟鍗曟嵁:" + HBillNo);
+ oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板鐢熶骇璁㈠崟鍗曟嵁锛�" + HBillNo + "','LMES-鐢熶骇璁㈠崟妯″潡','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+
}
else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
{
@@ -472,11 +483,14 @@
//淇敼
oCN.RunProc("update Sc_ICMOBillMain set " +
"HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
- ", HSeOrderBillNo='" + HSeOrderBillNo + "', HSeOrderInterID=" + HSeOrderInterID + ", HSeOrderEntryID=" + HSeOrderEntryID + ", HEmpID=" + HEmpID + ", HCusID=" + HCusID + "" +
- ", HCenterID=" + HCenterID + ",HBomID=" + HBomID + " where HInterID=" + HInterID);
+ ", HSeOrderBillNo='" + HSeOrderBillNo + "', HSeOrderInterID=" + HSeOrderInterID + ", HSeOrderEntryID=" + HSeOrderEntryID + ", HEmpID=" + HEmpID + ", HCusID=" + HCusID +
+ ", HCenterID=" + HCenterID + ",HBomID=" + HBomID + ",HIsStockQty='"+ HIsStockQty + "',HRemark3='" + HRemark3 + "' where HInterID=" + HInterID);
//鍒犻櫎瀛愯〃
oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'");
+
+ LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼鐢熶骇璁㈠崟鍗曟嵁:" + HBillNo);
+ oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼鐢熶骇璁㈠崟鍗曟嵁锛�" + HBillNo + "','LMES-鐢熶骇璁㈠崟妯″潡','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
}
//淇濆瓨瀛愯〃
objJsonResult = AddBillSub_NoTable(msg3, HInterID, OperationType, HEntryID);
@@ -556,15 +570,14 @@
,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS
,HBomID,HEntryCusID,HSTOCKINORGID
,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney
- ,HAuxQty,HAuxUnit,HWidth,HWeight,HColorRemark)
+ ,HAuxQty,HAuxUnit,HWidth,HWeight,HColorRemark,HCusMaterName,HCusModel)
values({HInterID},{HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)}
,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
,'{(oSub.HBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HBeginDate.ToString())}','{(oSub.HEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HEndDate.ToString())}'
,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},{oSub.HSTATUS}
,{oSub.HBomID} ,{oSub.HCusID} ,{oSub.HSTOCKINORGID}
,0,0,'','',0,0
- ,{oSub.HAuxQty},{oSub.HAuxUnit},{oSub.HWidth},{oSub.HWeight},'{oSub.HColorRemark}')");
-
+ ,{oSub.HAuxQty},{oSub.HAuxUnit},{oSub.HWidth},{oSub.HWeight},'{oSub.HColorRemark}','{oSub.HCusMaterName}','{oSub.HCusModel}')");
objJsonResult.code = "1";
objJsonResult.count = 1;
@@ -816,6 +829,8 @@
{
try
{
+ string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О
+
//鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBill_Drop", 1, false, user))
{
@@ -845,6 +860,22 @@
return objJsonResult; ;
}
+ string sReturn = "";
+ if (oSystemParameter.ShowBill(ref sReturn))
+ {
+ if (oSystemParameter.omodel.Sc_ICMOBill_DeleterAndMakerMustSame == "Y")
+ {
+ if (ds.Tables[0].Rows[0]["HMaker"].ToString() != user && (user != "admin" && user != "Admin"))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙兘鍒犻櫎鏈汉鐨勫崟鎹紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ }
+
if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
{
objJsonResult.code = "0";
@@ -854,8 +885,47 @@
return objJsonResult; ;
}
+ var DataSet = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillMain where HICMOBillNo='" + ds.Tables[0].Rows[0]["HBillNo"].ToString() +"'", "Sc_ProcessExchangeBillMain");
+
+ if (DataSet.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭笅鎺ㄥ伐搴忔祦杞崱,涓嶅厑璁稿垹闄わ紒";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+ }
+
+ DataSet = oCN.RunProcReturn("select * from h_v_IF_ProductInBillList where 婧愬崟鍗曞彿='" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "'", "h_v_IF_ProductInBillList");
+
+ if (DataSet.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭笅鎺ㄧ敓浜у叆搴撳崟,涓嶅厑璁稿垹闄わ紒";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+ }
+
+ DataSet = oCN.RunProcReturn("select * from h_v_IF_MateOutBillList where 婧愬崟鍗曞彿='" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "'", "h_v_IF_MateOutBillList");
+
+ if (DataSet.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭笅鎺ㄧ敓浜ч鏂欏崟,涓嶅厑璁稿垹闄わ紒";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+ }
+
+
+
oCN.RunProc("delete from Sc_ICMOBillMain where HInterID=" + HInterID);
oCN.RunProc("delete from Sc_ICMOBillSub where HInterID=" + HInterID);
+
+ LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鍒犻櫎鐢熶骇璁㈠崟鍗曟嵁:" + ds.Tables[0].Rows[0]["HBillNo"].ToString());
+ oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鍒犻櫎鐢熶骇璁㈠崟鍗曟嵁锛�" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','LMES-鐢熶骇璁㈠崟妯″潡','" + DBUtility.ClsPub.IPAddress + "','鍒犻櫎鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+
oCN.Commit();//鎻愪氦浜嬪姟
objJsonResult.code = "0";
objJsonResult.count = 1;
@@ -1076,13 +1146,40 @@
#region 鐢熶骇浠诲姟鍗曡幏鍙栬溅闂�
[Route("Sc_ICMOBill/GetHDeptList")]
[HttpGet]
- public object GetHDeptList()
+ public object GetHDeptList(string HOrgID)
{
try
{
DataSet oDs = new DataSet();
//==========
- oDs = oCN.RunProcReturn("select HItemID,HName from Gy_Department", "Gy_Department");
+ oDs = oCN.RunProcReturn("select HItemID,HName from Gy_Department where HUSEORGID="+ HOrgID, "Gy_Department");
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鑾峰彇鎴愬姛锛�";
+ objJsonResult.data = oDs.Tables[0];
+ return objJsonResult; ;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐢熶骇浠诲姟鍗曡幏鍙栧伐浣滀腑蹇�
+ [Route("Sc_ICMOBill/GetHWorkCenterList")]
+ [HttpGet]
+ public object GetHWorkCenterList()
+ {
+ try
+ {
+ DataSet oDs = new DataSet();
+ //==========
+ oDs = oCN.RunProcReturn("select HItemID,HName from Gy_WorkCenter", "Gy_WorkCenter");
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "鑾峰彇鎴愬姛锛�";
--
Gitblit v1.9.1