From 8ca2d296feab2534837b166908d16983d79a0696 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期五, 17 三月 2023 09:15:56 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/Sc_ProcessMangementController.cs | 506 +++++++++++++++++++++++++++++++------------------------
1 files changed, 283 insertions(+), 223 deletions(-)
diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs
index 57522c3..07e7113 100644
--- a/WebAPI/Controllers/Sc_ProcessMangementController.cs
+++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -410,6 +410,14 @@
string OrganizationNUM = oCN.RunProcReturn("select HNumber from Xt_ORGANIZATIONS where HItemID=" + OrganizationID, "Xt_ORGANIZATIONS").Tables[0].Rows[0]["HNumber"].ToString();
//鏍规嵁宸ュ簭姹囨姤鍗曚富ID鑾峰彇宸ュ簭姹囨姤鍏ュ簱鍗曠殑鏁版嵁
DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc");
+ if(ds.Tables[0].Rows.Count <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鐢熸垚鐢熶骇姹囨姤鍗曡繃绋嬩腑娌℃湁鏌ヨ鍒板嚭绔欏崟";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
DataRow dr = ds.Tables[0].Rows[0];
//淇濆瓨
@@ -892,7 +900,7 @@
//DataRow dr = ds.Tables[0].Rows[0];
//鍒ゆ柇鏈鎶ュ簾鎬绘暟閲忔槸鍚︿负0
- var DTable = oCN.RunProcReturn("select sum(HWasterQty) HWasterQty from Sc_StationOutBillMain where HProcExchBillNo='"+ BillNo + "' and HBFFlag=0 ", "Sc_StationOutBillMain").Tables[0];
+ var DTable = oCN.RunProcReturn("select isnull(sum(HWasterQty),0) HWasterQty from Sc_StationOutBillMain where HProcExchBillNo='"+ BillNo + "' and HBFFlag=0 ", "Sc_StationOutBillMain").Tables[0];
if (double.Parse(DTable.Rows[0]["HWasterQty"].ToString()) == 0)
{
@@ -1139,6 +1147,259 @@
}
+ ///// <summary>
+ ///// 鐢熸垚閲戣澏浜戞潵鏂欐楠屽崟
+ ///// </summary>
+ ///// <param name="InterID">宸ュ簭姹囨姤鍗曚富ID</param>
+ ///// <returns></returns>
+ //[Route("QCStockInCheckBill/set_SaveQCStockInCheckBill_Json")]
+ //[HttpGet]
+ //public object set_SaveQCStockInCheckBill_Json(string HZJOrgNumber, string HMaterNumber, string HUnitNumber,
+ // double HCheckQty, double HRightQty, double HBadQty,
+ // string HCheckResult, string HSupNumber,
+ // string HUseResult, Int64 HSeQ, Int64 HSourceInterID,
+ // Int64 HSourceEntryID, string HSourceBillNo, string user,
+ // Int64 HWHID, Int64 HSPID, Int64 HSupID, Int64 HKeeperID,
+ // Int64 HMaterID, string HSourceBillType, Int64 HSLInterID,
+ // Int64 HSLEntryID, string HSLBillNo, Int64 HSLSeQ, string HBillNo, Int64 HInterID)
+ //{
+ // try
+ // {
+ // //鑾峰彇鐢熶骇姹囨姤鍗曟渶澶nterID鍜屽崟鎹彿
+ // //Int64 HInterID = DBUtility.ClsPub.CreateBillID("7503", ref DBUtility.ClsPub.sExeReturnInfo);
+ // //string HBillNo = DBUtility.ClsPub.CreateBillCode("7503", ref DBUtility.ClsPub.sExeReturnInfo, true);
+
+ // DataSet ds1 = oCN.RunProcReturn("select * from MES_AccessoriesList where HSourceBillNo = '" + HBillNo + "'", "MES_AccessoriesList");
+ // string HFileName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFileName"]);
+ // string HFilePath = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFilePath"]);
+
+
+
+ // string path = HFilePath;
+ // FileInfo fi = new FileInfo(path);
+ // long len = fi.Length;
+ // byte[] buffer = new byte[len];
+ // FileStream fs = new FileStream(path, FileMode.Open);
+ // fs.Read(buffer, 0, (int)len);
+ // //鏂囦欢IO娴�
+ // string a = Convert.ToBase64String(buffer);
+
+
+ // //淇濆瓨
+ // oCN.BeginTran();
+ // //鐢熶骇姹囨姤鍗曚富琛�
+ // oCN.RunProc("Insert Into QC_POStockInCheckBillMain " +
+ // "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HBillStatus,HChecker,HCheckDate" +
+ // ",HYear,HPeriod,HRemark,HSupID,HMaterID" +
+ // ",HInstockQty,HCheckQty,HRightQty,HBadQty,HFirstCheckEmp" +
+ // ",HCheckerResult,HSteelStoveNo,HSteelCompReport,HAspect,HSize" +
+ // ") " +
+ // " values('7503','7503'," + HInterID.ToString() + ",'" + HBillNo + "',getdate(),'" + user + "',getdate(),2,'" + user + "',getdate()" +
+ // ",DATENAME(YEAR,GETDATE()),0,''," + HSupID.ToString() + "," + HMaterID.ToString() +
+ // ",'" + HCheckQty.ToString() + "','" + HCheckQty.ToString() + "','" + HRightQty.ToString() + "','" + HBadQty.ToString() + "','" + HKeeperID.ToString() + "'" +
+ // ",'" + HCheckResult.ToString() + "','', '','',''" +
+ // ") ");
+ // //鐢熶骇姹囨姤鍗曞瓙琛�
+ // oCN.RunProc("Insert into QC_POStockInCheckBillSub " +
+ // " (HInterID,HEntryID,HCloseMan,HCloseType" +
+ // ",HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+ // ",HRelationQty,HRelationMoney,HQCCheckClassID,HQCCheckItemID,HQCStd," +
+ // "HResult,HQCRelValue,HProcCheckEmp,HProcCheckTime" +
+ // ") values("
+ // + HInterID.ToString() + ",1,'',''" +
+ // ",''," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "','" + HSourceBillType.ToString() + "'" +
+ // ",0,0,0,0,''" +
+ // ",'" + HCheckResult.ToString() + "','" + HCheckResult.ToString() + "','" + HKeeperID.ToString() + "',getdate()" +
+ // ") ");
+ // //鍚屾閲戣澏
+ // //璁块棶閲戣澏
+ // var loginRet = InvokeHelper.Login();
+ // var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
+ // if (isSuccess == 0)
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鎿嶄綔澶辫触,閲戣澏璐﹀彿鐧诲綍寮傚父銆�" + loginRet;
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ // }
+
+
+ // JObject model = new JObject();
+ // model.Add("FBillTypeID", new JObject() { ["Fnumber"] = "JYD001_SYS" }); //鍗曟嵁绫诲瀷 鏉ユ枡妫�楠屽崟JYD001_SYS
+ // model.Add("FBusinessType", "1"); //涓氬姟绫诲瀷
+ // model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //鍗曟嵁鏃ユ湡
+ // model.Add("FInspectOrgId", new JObject() { ["Fnumber"] = HZJOrgNumber.ToString() }); //璐ㄦ缁勭粐
+ // model.Add("FSourceOrgId", new JObject() { ["Fnumber"] = HZJOrgNumber.ToString() }); //鏉ユ簮缁勭粐
+ // model.Add("FISSYNCED", "false");// 鏄惁宸插悓姝�
+ // model.Add("F_PGKJ_Date", DateTime.Now.ToString("yyyy-MM-dd"));// 鎶ユ鏃ユ湡
+ // model.Add("FBillNo", HBillNo);
+
+ // JArray Fentity = new JArray();
+ // JObject FentityModel = new JObject();
+ // FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = HMaterNumber.ToString() });// 鐗╂枡鍐呯爜
+ // FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = HUnitNumber.ToString() });//璁¢噺鍗曚綅鍐呯爜
+ // FentityModel.Add("FInspectQty", HCheckQty.ToString());// 妫�楠屾暟閲�
+ // FentityModel.Add("FQualifiedQty", HRightQty.ToString());// 鍚堟牸鏁伴噺
+ // FentityModel.Add("FUnqualifiedQty", HBadQty.ToString());// 涓嶅悎鏍兼暟閲�
+ // FentityModel.Add("FInspectResult", HCheckResult.ToString());// 妫�楠岀粨鏋�
+ // FentityModel.Add("FQCStatus", "1");// 璐ㄦ鐘舵��
+ // FentityModel.Add("FIsRelated", false);// 涓嶈壇鍝佸叧鑱旀爣蹇�
+ // FentityModel.Add("FSrcBillType0", "PUR_ReceiveBill");// 婧愬崟绫诲瀷
+ // FentityModel.Add("FBaseUnitId", new JObject() { ["Fnumber"] = HUnitNumber.ToString() });//鍩烘湰鍗曚綅
+ // FentityModel.Add("FBaseInspectQty", HCheckQty.ToString());//鍩烘湰鍗曚綅妫�楠屾暟閲�
+ // FentityModel.Add("FSupplierId", new JObject() { ["Fnumber"] = HSupNumber.ToString() }); // 渚涘簲鍟�
+ // //FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = HWHNumber.ToString() }); // 浠撳簱
+ // FentityModel.Add("FInspectTimes","1"); // 妫�楠屾鏁�
+ // FentityModel.Add("FTimeUnit","24");//鏃堕棿鍗曚綅
+ // FentityModel.Add("FSAMPLEDAMAGEBEARER","2");//鏍锋湰鐮村潖鎵挎媴鏂�
+ // FentityModel.Add("FISFIRSTINSPECT", false);//棣栨
+ // FentityModel.Add("FBaseQualifiedQty", HRightQty.ToString());//鍩烘湰鍗曚綅鍚堟牸鏁�
+ // FentityModel.Add("FBaseAcceptQty", HRightQty.ToString());//鍩烘湰鍗曚綅鎺ユ敹鏁�
+ // FentityModel.Add("FCurrency", new JObject() { ["Fnumber"] = "PRE001" });//甯佸埆
+ // FentityModel.Add("FIsSplitRow ", false);// 鏄惁鎷嗗垎琛�
+
+ // JArray Fentity2 = new JArray();
+ // JObject FentityModel2 = new JObject();
+ // FentityModel2.Add("FPolicyMaterialId", new JObject() { ["Fnumber"] = HMaterNumber.ToString() });// 鐗╂枡鍐呯爜
+ // FentityModel2.Add("FPolicyStatus", "1"); //鐘舵��
+ // FentityModel2.Add("FPolicyQty", HRightQty.ToString()); //鏁伴噺
+ // FentityModel2.Add("FBasePolicyQty", HRightQty.ToString()); //鍩烘湰鍗曚綅鏁伴噺
+ // FentityModel2.Add("FUsePolicy", HUseResult.ToString()); //浣跨敤鍐崇瓥
+ // FentityModel2.Add("FIsCheck", false); //鏄惁鎶芥
+ // FentityModel2.Add("FIsDefectProcess", false); //涓嶈壇澶勭悊
+ // FentityModel2.Add("FCanSale", false); //鍙攢鍞�
+ // FentityModel2.Add("FIsMRBReview", false); //MRP璇勫
+ // FentityModel2.Add("FIsReturn", true); //鍒ら��
+ // FentityModel2.Add("FIsRelatedDefect", false); //涓嶈壇鍝佸叧鑱旀爣蹇�
+ // Fentity2.Add(FentityModel2);
+ // FentityModel.Add("FPolicyDetail", Fentity2);
+
+
+
+ // JArray Fentity3 = new JArray();
+ // JObject FentityModel3 = new JObject();
+ // FentityModel3.Add("FDetailID", "0");//
+ // FentityModel3.Add("FSrcBillType", "PUR_ReceiveBill"); //婧愬崟绫诲瀷
+ // FentityModel3.Add("FSrcBillNo", HSLBillNo.ToString()); //鏀舵枡閫氱煡鍗曞崟鍙�
+ // FentityModel3.Add("FSrcInterId", HSLInterID.ToString()); //鏀舵枡閫氱煡鍗曚富ID
+ // FentityModel3.Add("FSrcEntryId",HSLEntryID.ToString()); //鏀舵枡閫氱煡鍗曞瓙ID
+ // FentityModel3.Add("FSrcEntrySeq", HSLSeQ.ToString()); //婧愬崟琛屽彿
+ // FentityModel3.Add("FOrderType", new JObject() { ["FID"] = "PUR_PurchaseOrder" }); // 璁㈠崟绫诲瀷
+ // FentityModel3.Add("FOrderBillNo", HSourceBillNo.ToString()); //璁㈠崟鍗曞彿
+ // FentityModel3.Add("FOrderId", HSourceInterID.ToString()); //璁㈠崟涓籌D
+ // FentityModel3.Add("FOrderEntryId", HSourceEntryID.ToString()); //璁㈠崟瀛怚D
+ // FentityModel3.Add("FOrderEntrySeq", HSeQ.ToString()); //璁㈠崟琛屽彿
+ // Fentity3.Add(FentityModel3);
+ // FentityModel.Add("FReferDetail", Fentity3);
+
+
+ // JArray Fentity4 = new JArray();
+ // JObject FentityModel4 = new JObject();
+ // FentityModel4.Add("FEntity_Link_FRuleId", "QM_PURReceive2Inspect"); //鍗曟嵁杞崲瑙勫垯
+ // FentityModel4.Add("FEntity_Link_FSTableName", "T_PUR_RECEIVEENTRY"); //鏀舵枡閫氱煡鍗曞瓙琛�
+ // FentityModel4.Add("FEntity_Link_FSBillId", HSLInterID.ToString()); //鏀舵枡閫氱煡鍗曚富鍐呯爜
+ // FentityModel4.Add("FEntity_Link_FSId", HSLEntryID.ToString()); //鏀舵枡閫氱煡鍗曞瓙鍐呯爜
+ // FentityModel4.Add("FEntity_Link_FBaseAcceptQty", HRightQty.ToString()); //
+ // FentityModel4.Add("FEntity_Link_FBaseAcceptQtyOld", HRightQty.ToString()); //
+ // FentityModel4.Add("FEntity_Link_FBaseInspectQtyOld", HRightQty.ToString()); //
+ // FentityModel4.Add("FEntity_Link_FInspectQtyOld", HRightQty.ToString()); //
+ // Fentity4.Add(FentityModel4);
+ // FentityModel.Add("FEntity_Link", Fentity4);
+
+
+
+ // Fentity.Add(FentityModel);
+ // model.Add("FEntity", Fentity); //鏄庣粏淇℃伅
+ // JObject jsonRoot = new JObject()
+ // {
+ // ["Creator"] = "",
+ // ["NeedUpDateFields"] = new JArray(),
+ // ["NeedReturnFields"] = new JArray(),
+ // ["IsDeleteEntry"] = "false",
+ // ["SubSystemId"] = "",
+ // ["IsVerifyBaseDataField"] = "false",
+ // //["IsAutoSubmitAndAudit"] = true,//鑷姩璋冪敤鎻愪氦鍜屽鏍稿姛鑳�
+ // ["Model"] = model
+ // };
+
+ // string result = InvokeHelper.Save("QM_InspectBill", JsonConvert.SerializeObject(jsonRoot));//淇濆瓨
+ // //鍒ゆ柇淇濆瓨鏄惁鎴愬姛
+ // if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
+ // {
+ // LogService.Write("鏉ユ枡妫�楠屽崟淇濆瓨閿欒jsonRoot:" + jsonRoot);
+ // oCN.RollBack();
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = $"鏉ユ枡妫�楠屽崟鍚屾閲戣澏浜戝け璐ワ紒鍗曞彿:{HBillNo.ToString()}" + jsonRoot;
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ // }
+ // //鎻愪氦瀹℃牳
+ // string result1 = string.Empty;
+ // string result2 = string.Empty;
+ // var fID = JObject.Parse(result)["Result"]["Id"].ToString();
+ // var fBillNo = JObject.Parse(result)["Result"]["Number"].ToString();
+ // var json = new
+ // {
+ // Ids = fID,
+ // };
+
+ // K3CloudApiClient client = new K3CloudApiClient("http://192.168.80.90/k3cloud/");
+
+
+
+ // result1 = InvokeHelper.Submit("QM_InspectBill", JsonConvert.SerializeObject(json));//鎻愪氦
+ // result2 = InvokeHelper.Audit("QM_InspectBill", JsonConvert.SerializeObject(json));//鎻愪氦
+ // if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
+ // {
+
+
+
+ // oCN.RollBack();
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = $"鏉ユ枡妫�楠屽崟鍙凤細{fBillNo}锛屾彁浜ゅけ璐�" + result;
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ // }
+ // else
+ // {
+ // string jsonStr = "{" +
+ // " \"FileName\":\"" + HFileName + "\"," +
+ // " \"FormId\":\"QM_InspectBill\"," +
+ // " \"IsLast\":\"true\"," +
+ // " \"InterId\":\"" + HInterID + "\"," +
+ // " \"BillNO\":\"" + HBillNo + "\"," +
+ // " \"AliasFileName\":\"test\"," +
+ // " \"SendByte\":\"" + a + "\"," +
+ // "}";
+
+ // var ret = client.AttachmentUpload(jsonStr);
+ // }
+
+ // oCN.Commit();
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 1;
+ // objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ // objJsonResult.data = 1;
+ // return objJsonResult;
+ // }
+ // catch (Exception e)
+ // {
+ // oCN.RollBack();
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "Exception锛�" + e.ToString();
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ // }
+ //}
+ //#endregion
+
+
+
+
/// <summary>
/// 鐢熸垚閲戣澏浜戞潵鏂欐楠屽崟
/// </summary>
@@ -1146,240 +1407,39 @@
/// <returns></returns>
[Route("QCStockInCheckBill/set_SaveQCStockInCheckBill_Json")]
[HttpGet]
- public object set_SaveQCStockInCheckBill_Json(string HZJOrgNumber, string HMaterNumber, string HUnitNumber,
+ public object set_SaveQCStockInCheckBill_Json(string HZJOrgNumber, string HMaterNumber, string HUnitNumber,
double HCheckQty, double HRightQty, double HBadQty,
- string HCheckResult, string HSupNumber, string HWHNumber,
- string HUseResult, Int64 HSeQ, Int64 HSourceInterID,
+ string HCheckResult, string HSupNumber,
+ string HUseResult, Int64 HSeQ, Int64 HSourceInterID,
Int64 HSourceEntryID, string HSourceBillNo, string user,
- Int64 HWHID, Int64 HSPID, Int64 HSupID, Int64 HKeeperID,
+ Int64 HWHID, Int64 HSPID, Int64 HSupID, Int64 HKeeperID,
Int64 HMaterID, string HSourceBillType, Int64 HSLInterID,
- Int64 HSLEntryID, string HSLBillNo, Int64 HSLSeQ, string HBillNo, Int64 HInterID)
+ Int64 HSLEntryID, string HSLBillNo, Int64 HSLSeQ, string HBillNo, Int64 HInterID,ref string sErrMsg)
{
- try
+ WebS2.WebService1 oWebs1 = new WebS2.WebService1();
+
+
+ //oWebs1.Url = "http://localhost:9099/WebService1.asmx";
+ //K3CloudApiClient client = new K3CloudApiClient("http://192.168.80.90/k3cloud/");
+ if (oWebs1.set_SaveQcStockInCheckBill_New(HZJOrgNumber, HMaterNumber, HUnitNumber, HCheckQty, HRightQty, HBadQty
+ , HCheckResult, HSupNumber, HUseResult, HSeQ, HSourceInterID
+ , HSourceEntryID, HSourceBillNo, user, HWHID, HSPID
+ , HSupID, HKeeperID, HMaterID, HSourceBillType, HSLInterID
+ , HSLEntryID, HSLBillNo, HSLSeQ, HBillNo, HInterID
+ , ref sErrMsg))
{
- //鑾峰彇鐢熶骇姹囨姤鍗曟渶澶nterID鍜屽崟鎹彿
- //Int64 HInterID = DBUtility.ClsPub.CreateBillID("7503", ref DBUtility.ClsPub.sExeReturnInfo);
- //string HBillNo = DBUtility.ClsPub.CreateBillCode("7503", ref DBUtility.ClsPub.sExeReturnInfo, true);
-
- DataSet ds1 = oCN.RunProcReturn("select * from MES_AccessoriesList where HSourceBillNo = '" + HBillNo + "'", "MES_AccessoriesList");
- string HFileName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFileName"]);
- string HFilePath = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFilePath"]);
-
-
-
- string path = HFilePath;
- FileInfo fi = new FileInfo(path);
- long len = fi.Length;
- byte[] buffer = new byte[len];
- FileStream fs = new FileStream(path, FileMode.Open);
- fs.Read(buffer, 0, (int)len);
- //鏂囦欢IO娴�
- string a = Convert.ToBase64String(buffer);
-
-
- //淇濆瓨
- oCN.BeginTran();
- //鐢熶骇姹囨姤鍗曚富琛�
- oCN.RunProc("Insert Into QC_POStockInCheckBillMain " +
- "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HBillStatus,HChecker,HCheckDate" +
- ",HYear,HPeriod,HRemark,HSupID,HMaterID" +
- ",HInstockQty,HCheckQty,HRightQty,HBadQty,HFirstCheckEmp" +
- ",HCheckerResult,HSteelStoveNo,HSteelCompReport,HAspect,HSize" +
- ") " +
- " values('7503','7503'," + HInterID.ToString() + ",'" + HBillNo + "',getdate(),'" + user + "',getdate(),2,'" + user + "',getdate()" +
- ",DATENAME(YEAR,GETDATE()),0,''," + HSupID.ToString() + "," + HMaterID.ToString() +
- ",'" + HCheckQty.ToString() + "','" + HCheckQty.ToString() + "','" + HRightQty.ToString() + "','" + HBadQty.ToString() + "','" + HKeeperID.ToString() + "'" +
- ",'" + HCheckResult.ToString() + "','', '','',''" +
- ") ");
- //鐢熶骇姹囨姤鍗曞瓙琛�
- oCN.RunProc("Insert into QC_POStockInCheckBillSub " +
- " (HInterID,HEntryID,HCloseMan,HCloseType" +
- ",HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
- ",HRelationQty,HRelationMoney,HQCCheckClassID,HQCCheckItemID,HQCStd," +
- "HResult,HQCRelValue,HProcCheckEmp,HProcCheckTime" +
- ") values("
- + HInterID.ToString() + ",1,'',''" +
- ",''," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "','" + HSourceBillType.ToString() + "'" +
- ",0,0,0,0,''" +
- ",'" + HCheckResult.ToString() + "','" + HCheckResult.ToString() + "','" + HKeeperID.ToString() + "',getdate()" +
- ") ");
- //鍚屾閲戣澏
- //璁块棶閲戣澏
- var loginRet = InvokeHelper.Login();
- var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
- if (isSuccess == 0)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "鎿嶄綔澶辫触,閲戣澏璐﹀彿鐧诲綍寮傚父銆�" + loginRet;
- objJsonResult.data = null;
- return objJsonResult;
- }
-
-
- JObject model = new JObject();
- model.Add("FBillTypeID", new JObject() { ["Fnumber"] = "JYD001_SYS" }); //鍗曟嵁绫诲瀷 鏉ユ枡妫�楠屽崟JYD001_SYS
- model.Add("FBusinessType", "1"); //涓氬姟绫诲瀷
- model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //鍗曟嵁鏃ユ湡
- model.Add("FSourceOrgId", new JObject() { ["Fnumber"] = HZJOrgNumber.ToString() }); //鏉ユ簮缁勭粐
- model.Add("FInspectOrgId", new JObject() { ["Fnumber"] = HZJOrgNumber.ToString() }); //璐ㄦ缁勭粐
- model.Add("FISSYNCED", "false");// 鏄惁宸插悓姝�
- model.Add("F_PGKJ_Date", DateTime.Now.ToString("yyyy-MM-dd"));// 鎶ユ鏃ユ湡
- model.Add("FBillNo", HBillNo);
-
- JArray Fentity = new JArray();
- JObject FentityModel = new JObject();
- FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = HMaterNumber.ToString() });// 鐗╂枡鍐呯爜
- FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = HUnitNumber.ToString() });//璁¢噺鍗曚綅鍐呯爜
- FentityModel.Add("FInspectQty", HCheckQty.ToString());// 妫�楠屾暟閲�
- FentityModel.Add("FQualifiedQty", HRightQty.ToString());// 鍚堟牸鏁伴噺
- FentityModel.Add("FUnqualifiedQty", HBadQty.ToString());// 涓嶅悎鏍兼暟閲�
- FentityModel.Add("FInspectResult", HCheckResult.ToString());// 妫�楠岀粨鏋�
- FentityModel.Add("FQCStatus", "1");// 璐ㄦ鐘舵��
- FentityModel.Add("FIsRelated", false);// 涓嶈壇鍝佸叧鑱旀爣蹇�
- FentityModel.Add("FSrcBillType0", "PUR_ReceiveBill");// 婧愬崟绫诲瀷
- FentityModel.Add("FBaseUnitId", new JObject() { ["Fnumber"] = HUnitNumber.ToString() });//鍩烘湰鍗曚綅
- FentityModel.Add("FBaseInspectQty", HCheckQty.ToString());//鍩烘湰鍗曚綅妫�楠屾暟閲�
- FentityModel.Add("FSupplierId", new JObject() { ["Fnumber"] = HSupNumber.ToString() }); // 渚涘簲鍟�
- //FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = HWHNumber.ToString() }); // 浠撳簱
- FentityModel.Add("FInspectTimes","1"); // 妫�楠屾鏁�
- FentityModel.Add("FTimeUnit","24");//鏃堕棿鍗曚綅
- FentityModel.Add("FSAMPLEDAMAGEBEARER","2");//鏍锋湰鐮村潖鎵挎媴鏂�
- FentityModel.Add("FISFIRSTINSPECT", false);//棣栨
- FentityModel.Add("FBaseQualifiedQty", HRightQty.ToString());//鍩烘湰鍗曚綅鍚堟牸鏁�
- FentityModel.Add("FBaseAcceptQty", HRightQty.ToString());//鍩烘湰鍗曚綅鎺ユ敹鏁�
- FentityModel.Add("FCurrency", new JObject() { ["Fnumber"] = "PRE001" });//甯佸埆
- FentityModel.Add("FIsSplitRow ", false);// 鏄惁鎷嗗垎琛�
-
- JArray Fentity2 = new JArray();
- JObject FentityModel2 = new JObject();
- FentityModel2.Add("FPolicyMaterialId", new JObject() { ["Fnumber"] = HMaterNumber.ToString() });// 鐗╂枡鍐呯爜
- FentityModel2.Add("FPolicyStatus", "1"); //鐘舵��
- FentityModel2.Add("FPolicyQty", HRightQty.ToString()); //鏁伴噺
- FentityModel2.Add("FBasePolicyQty", HRightQty.ToString()); //鍩烘湰鍗曚綅鏁伴噺
- FentityModel2.Add("FUsePolicy", HUseResult.ToString()); //浣跨敤鍐崇瓥
- FentityModel2.Add("FIsCheck", false); //鏄惁鎶芥
- FentityModel2.Add("FIsDefectProcess", false); //涓嶈壇澶勭悊
- FentityModel2.Add("FCanSale", false); //鍙攢鍞�
- FentityModel2.Add("FIsMRBReview", false); //MRP璇勫
- FentityModel2.Add("FIsReturn", true); //鍒ら��
- FentityModel2.Add("FIsRelatedDefect", false); //涓嶈壇鍝佸叧鑱旀爣蹇�
- Fentity2.Add(FentityModel2);
- FentityModel.Add("FPolicyDetail", Fentity2);
-
-
-
- JArray Fentity3 = new JArray();
- JObject FentityModel3 = new JObject();
- FentityModel3.Add("FDetailID", "0");//
- FentityModel3.Add("FSrcBillType", "PUR_ReceiveBill"); //婧愬崟绫诲瀷
- FentityModel3.Add("FSrcBillNo", HSLBillNo.ToString()); //鏀舵枡閫氱煡鍗曞崟鍙�
- FentityModel3.Add("FSrcInterId", HSLInterID.ToString()); //鏀舵枡閫氱煡鍗曚富ID
- FentityModel3.Add("FSrcEntryId",HSLEntryID.ToString()); //鏀舵枡閫氱煡鍗曞瓙ID
- FentityModel3.Add("FSrcEntrySeq", HSLSeQ.ToString()); //婧愬崟琛屽彿
- FentityModel3.Add("FOrderType", new JObject() { ["FID"] = "PUR_PurchaseOrder" }); // 璁㈠崟绫诲瀷
- FentityModel3.Add("FOrderBillNo", HSourceBillNo.ToString()); //璁㈠崟鍗曞彿
- FentityModel3.Add("FOrderId", HSourceInterID.ToString()); //璁㈠崟涓籌D
- FentityModel3.Add("FOrderEntryId", HSourceEntryID.ToString()); //璁㈠崟瀛怚D
- FentityModel3.Add("FOrderEntrySeq", HSeQ.ToString()); //璁㈠崟琛屽彿
- Fentity3.Add(FentityModel3);
- FentityModel.Add("FReferDetail", Fentity3);
-
-
- JArray Fentity4 = new JArray();
- JObject FentityModel4 = new JObject();
- FentityModel4.Add("FEntity_Link_FRuleId", "QM_PURReceive2Inspect"); //鍗曟嵁杞崲瑙勫垯
- FentityModel4.Add("FEntity_Link_FSTableName", "T_PUR_RECEIVEENTRY"); //鏀舵枡閫氱煡鍗曞瓙琛�
- FentityModel4.Add("FEntity_Link_FSBillId", HSLInterID.ToString()); //鏀舵枡閫氱煡鍗曚富鍐呯爜
- FentityModel4.Add("FEntity_Link_FSId", HSLEntryID.ToString()); //鏀舵枡閫氱煡鍗曞瓙鍐呯爜
- FentityModel4.Add("FEntity_Link_FBaseAcceptQty", HRightQty.ToString()); //
- FentityModel4.Add("FEntity_Link_FBaseAcceptQtyOld", HRightQty.ToString()); //
- FentityModel4.Add("FEntity_Link_FBaseInspectQtyOld", HRightQty.ToString()); //
- FentityModel4.Add("FEntity_Link_FInspectQtyOld", HRightQty.ToString()); //
- Fentity4.Add(FentityModel4);
- FentityModel.Add("FEntity_Link", Fentity4);
-
-
-
- Fentity.Add(FentityModel);
- model.Add("FEntity", Fentity); //鏄庣粏淇℃伅
- JObject jsonRoot = new JObject()
- {
- ["Creator"] = "",
- ["NeedUpDateFields"] = new JArray(),
- ["NeedReturnFields"] = new JArray(),
- ["IsDeleteEntry"] = "false",
- ["SubSystemId"] = "",
- ["IsVerifyBaseDataField"] = "false",
- //["IsAutoSubmitAndAudit"] = true,//鑷姩璋冪敤鎻愪氦鍜屽鏍稿姛鑳�
- ["Model"] = model
- };
-
- string result = InvokeHelper.Save("QM_InspectBill", JsonConvert.SerializeObject(jsonRoot));//淇濆瓨
- //鍒ゆ柇淇濆瓨鏄惁鎴愬姛
- if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
- {
- LogService.Write("鏉ユ枡妫�楠屽崟淇濆瓨閿欒jsonRoot:" + jsonRoot);
- oCN.RollBack();
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = $"鏉ユ枡妫�楠屽崟鍚屾閲戣澏浜戝け璐ワ紒鍗曞彿:{HBillNo.ToString()}" + jsonRoot;
- objJsonResult.data = null;
- return objJsonResult;
- }
- //鎻愪氦瀹℃牳
- string result1 = string.Empty;
- string result2 = string.Empty;
- var fID = JObject.Parse(result)["Result"]["Id"].ToString();
- var fBillNo = JObject.Parse(result)["Result"]["Number"].ToString();
- var json = new
- {
- Ids = fID,
- };
-
- K3CloudApiClient client = new K3CloudApiClient("http://192.168.80.90/k3cloud/");
-
-
-
- result1 = InvokeHelper.Submit("QM_InspectBill", JsonConvert.SerializeObject(json));//鎻愪氦
- result2 = InvokeHelper.Audit("QM_InspectBill", JsonConvert.SerializeObject(json));//鎻愪氦
- if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
- {
- string jsonStr = "{" +
- " \"FileName\":\"" + HFileName + "\"," +
- " \"FormId\":\"QM_InspectBill\"," +
- " \"IsLast\":\"true\"," +
- " \"InterId\":\"" + HInterID + "\"," +
- " \"BillNO\":\"" + HBillNo + "\"," +
- " \"AliasFileName\":\"test\"," +
- " \"SendByte\":\"" + a + "\"," +
- "}";
-
- var ret = client.AttachmentUpload(jsonStr);
-
-
- oCN.RollBack();
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = $"鏉ユ枡妫�楠屽崟鍙凤細{fBillNo}锛屾彁浜ゅけ璐�" + result;
- objJsonResult.data = null;
- return objJsonResult;
- }
-
- oCN.Commit();
objJsonResult.code = "0";
objJsonResult.count = 1;
- objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
- objJsonResult.data = 1;
+ objJsonResult.Message = "鐢熸垚鍗曟嵁鎴愬姛锛�";
+ objJsonResult.data = null;
return objJsonResult;
}
- catch (Exception e)
+ else
{
- oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "Exception锛�" + e.ToString();
- objJsonResult.data = null;
+ objJsonResult.Message = "鐢熸垚鍗曟嵁澶辫触锛�";
+ objJsonResult.data = sErrMsg;
return objJsonResult;
}
}
--
Gitblit v1.9.1