From 1bbd45a2bf28afc9da6abe335f8072cf29d78456 Mon Sep 17 00:00:00 2001
From: ch <37327@LLOOCCY>
Date: 星期二, 29 十一月 2022 08:58:14 +0800
Subject: [PATCH] 修改了安瑞所需模块解析条码方法

---
 WebAPI/Controllers/Sc_ProcessMangementController.cs |  194 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 194 insertions(+), 0 deletions(-)

diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs
index 226e296..af39f81 100644
--- a/WebAPI/Controllers/Sc_ProcessMangementController.cs
+++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -1019,6 +1019,200 @@
         }
         #endregion
 
+
+
+
+
+        /// <summary>
+        /// 鐢熸垚閲戣澏浜戜骇鍝佹楠屽崟
+        /// </summary>
+        /// <param name="InterID">宸ュ簭姹囨姤鍗曚富ID</param>
+        /// <returns></returns>
+        [Route("SCStockInCheckBill/set_SaveSCStockInCheckBill_Json")]
+        [HttpGet]
+        public object set_SaveSCStockInCheckBill_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,
+            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)
+        {
+            try
+            {
+                //鑾峰彇鐢熶骇姹囨姤鍗曟渶澶nterID鍜屽崟鎹彿
+                Int64 HInterID = DBUtility.ClsPub.CreateBillID("7501", ref DBUtility.ClsPub.sExeReturnInfo);
+                string HBillNo = DBUtility.ClsPub.CreateBillCode("7501", ref DBUtility.ClsPub.sExeReturnInfo, true);
+
+                //淇濆瓨
+                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"] = "JYD002_SYS" }); //鍗曟嵁绫诲瀷 浜у搧妫�楠屽崟JYD002_SYS
+                model.Add("FBusinessType", "3"); //涓氬姟绫诲瀷
+                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("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("FInspectResult", HCheckResult.ToString());//  妫�楠岀粨鏋�
+                FentityModel.Add("FQCStatus", "1");//  璐ㄦ鐘舵�� 
+                FentityModel.Add("FIsRelated", false);//  涓嶈壇鍝佸叧鑱旀爣蹇�
+                FentityModel.Add("FSrcBillType0", "SFC_OperationReport");//  婧愬崟绫诲瀷
+                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("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", false);   //鍒ら��
+                FentityModel2.Add("FIsRelatedDefect", false);   //涓嶈壇鍝佸叧鑱旀爣蹇�
+                Fentity2.Add(FentityModel2);
+                FentityModel.Add("FPolicyDetail", Fentity2);
+
+
+
+                //JArray Fentity3 = new JArray();
+                //JObject FentityModel3 = new JObject();
+                //FentityModel3.Add("FSrcBillType", "SFC_OperationReport");   //婧愬崟绫诲瀷
+                //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);
+                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()}" + result;
+                    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,
+                };
+                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;
+                }
+
+                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;
+            }
+        }
+
         /// <summary>
         /// 杩斿洖鐢熶骇姹囨姤鍗曞垪琛�
         ///鍙傛暟锛歴tring sql銆�

--
Gitblit v1.9.1