From 4318d57f8ba38c5c3b52a2f9d9972e158c08270c Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期五, 18 三月 2022 11:03:52 +0800
Subject: [PATCH] 1

---
 WebAPI/ListModels.cs                                               |    7 +
 WebAPI/Controllers/基础资料/基础资料/Gy_StockCheckItemBillController.cs    |    6 
 WebAPI/InvokeHelper.cs                                             |    9 +-
 WebAPI/Models/ClsQK_PackingBill.cs                                 |   36 +++++++++
 WebAPI/WebAPI.csproj                                               |    1 
 WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs             |  142 +++++++++++++++++++++++++++++++++++
 WebAPI/Controllers/生产管理/报工台工序/Sc_MESBeginStepWorkBillController.cs |    1 
 7 files changed, 195 insertions(+), 7 deletions(-)

diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockCheckItemBillController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockCheckItemBillController.cs"
index 86da5b8..175185b 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockCheckItemBillController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockCheckItemBillController.cs"
@@ -492,8 +492,8 @@
                     string HBillNo = "";
                     Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈�
                     DataSet ds1 = new DataSet();
-                    ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
-                    ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp");
+                    ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='W11201609050013'", "Gy_MouldFileMain");
+                    ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='W11201609050013' and HItemID='38'", "Sc_MouldStockBillMain_Temp");
                     DataRow dr = ds.Tables[0].Rows[0];
                     DataRow dr1 = ds1.Tables[0].Rows[0];
                     HInterID = DBUtility.ClsPub.CreateBillID("3827", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -515,7 +515,7 @@
                     HBatchNo,HQtyMust,HQty,HPrice,HMoney,HDesignLife,HLeaveLife,HUseLife,HWHID,HSCWHID,HSPID,HSCSPID,HSPGroupID,HCorrespondentTypeID,HCorrespondentID,
                     HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID) values(" + HInterID + ",1,'',getdate(),0,'',0,0,'',''," +
                     "0,0," + dr["HInterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr1["HQty"].ToString() + ",0," +
-                    "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + ",'" + dr1["HCorrespondentID"].ToString() + "',isnull('" + dr["HNowSupID"].ToString() + "',0),0,0"
+                    "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0"
                     + ",0,0,0," + userID + ",0,100005,'')");
                    
                     //涓昏〃
diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESBeginStepWorkBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESBeginStepWorkBillController.cs"
index 94f9e76..5336397 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESBeginStepWorkBillController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESBeginStepWorkBillController.cs"
@@ -1608,6 +1608,7 @@
                     var result = InvokeHelper.ExcuteOperation("PRD_MO", "ToStart", JsonConvert.SerializeObject(json));
                     if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                     {
+                        oCN.RollBack();
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
                         objJsonResult.Message = "瀵瑰簲閲戣澏浜戠敓浜ц鍗曟洿鏀瑰紑宸ョ姸鎬佸け璐ワ紒" + result;
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 5877890..0a6c7a5 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"
@@ -76,7 +76,149 @@
         #endregion
 
 
+        #region 澧欏挃瑁呯鍗曞洖杞︿簨浠�
+        [Route("Sc_ICMOBill/QK_PackingBillByXSBill")]
+        [HttpGet]
+        public object QK_PackingBillByXSBill(string HBillNo)
+        {
+            try
+            {
+                string sql = string.Format(@"select b.HMaterID,m.HNumber HMaterCode,m.HName HMaterName,b.HUnitID,u.HName HUnitName,
+                                b.HQty HQty,a.HAddress HAddress,b.HDate HDate,b.HOutStockQty HOutStockQty,b.HInvoiceQty HInvoiceQty,
+                                b.HTaxPrice HTaxPrice,b.HPrice HPrice,b.HMoney HMoney,a.HCusID HCusID,c.HName HCusName,a.HEmpID,e.HName HEmpName,
+                                i.HInterID,i.HBillNo
+                                from Xs_SeOrderBillMain a 
+                                left join  Xs_SeOrderBillSub b on a.HInterID=b.HInterID
+                                left join Gy_Material m on b.HMaterID=m.HItemID
+                                left join Gy_Unit u on b.HUnitID=u.HItemID
+                                left join Gy_Customer c on a.HCusID=c.HItemID
+                                left join Gy_Employee e on a.HEmpID=e.HItemID
+                                left join Sc_ICMOBillMain i on i.HSeOrderInterID=a.HInterID
+                                where a.HInterID=(select HSeOrderInterID from Sc_ICMOBillMain where HBillNo='" + HBillNo + "')");
+               
+                ds = oCN.RunProcReturn(sql, "Xs_SeOrderBillMain");
+                if (ds.Tables[0].Rows.Count != 0 || ds != null)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鑾峰彇鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏆傛棤瀵瑰簲鐨勯攢鍞槑缁嗭紒";
+                objJsonResult.data = ds.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/QK_PackingBillSavePack")]
+        [HttpPost]
+        public object QK_PackingBillSavePack([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();
 
+            ListModels oListModels = new ListModels();
+            try
+            {
+                if (msg4=="ZZ")
+                {
+                    //琛ㄤ綋鏁版嵁
+                    //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+
+                    msg2 = msg2.Replace("\\", "");
+                    msg2 = msg2.Replace("\n", "");  //\n
+                                                    //msg2 = msg2.Replace("'", "鈥�");
+                    List<Models.ClsQK_PackingBill> ls = new List<Models.ClsQK_PackingBill>();
+                    ls = oListModels.getObjectByJson_QK_PackingBill(msg2);
+                    oCN.BeginTran();
+                    foreach (Models.ClsQK_PackingBill oItemSub in ls)
+                    {
+                        var HInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo);
+                        var HBillNo = DBUtility.ClsPub.CreateBillCode("3783", ref DBUtility.ClsPub.sExeReturnInfo, true);
+                        string sql = string.Format(@"Insert Sc_PackUnionBillMain(HYear,HPeriod,HBillType,HInterID,HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID,
+                                                    HRemark,HBacker,HChecker,HMaker,HMakeDate,HUpDater,HCloseMan,HCloseType,HDeleteMan,
+                                                    HICMOInterID,HICMOBillNo,HBarCode_Pack,HMaterID,HUnitID,HWeight,HMWeight,HPWeight,
+                                                    HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo,HBillSubType)
+                                                    values('2022',1,'3783'," + HInterID + ",getdate(),'" + HBillNo + "',1,0,0," +
+                                                        "'鑷姩缁戝畾','','', " + msg3 + ",getdate(),'','',0,''," +
+                                                        oItemSub.HInterID + ",'" + oItemSub.HBillNo + "','" + HBillNo + "'," + oItemSub.HMaterID + "," + oItemSub.HUnitID + "," + oItemSub.HWeight + "," + oItemSub.HMWeight + "," + oItemSub.HPWeight + "," +
+                                                        "0,0," + oItemSub.HEmpID + ",0,0,'','','')");
+                        oCN.RunProc(sql);
+                    }
+                    oCN.Commit();
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鏁磋鐢熸垚鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+                else
+                {
+                    msg2 = msg2.Replace("\\", "");
+                    msg2 = msg2.Replace("\n", "");  //\n
+                                                    //msg2 = msg2.Replace("'", "鈥�");
+                    List<Models.ClsQK_PackingBill> ls = new List<Models.ClsQK_PackingBill>();
+                    ls = oListModels.getObjectByJson_QK_PackingBill(msg2);
+
+                    var HInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo);
+                    var HBillNo = DBUtility.ClsPub.CreateBillCode("3783", ref DBUtility.ClsPub.sExeReturnInfo, true);
+                    oCN.BeginTran();
+                    foreach (Models.ClsQK_PackingBill oItemSub in ls)
+                    {
+                        string sql = string.Format(@"insert into Sc_PackUnionBillSub(HInterID,HEntryID,HCloseMan,HCloseType,HRemark,
+                                                    HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,
+                                                    HRelationQty,HRelationMoney,HMaterID,HUnitID,HQty,HSourceID,HEquipID,HGroupID,HWorkerID,
+	                                                HScanDate,HBarCode,HBarCode_Pack)
+                                                    values("+HInterID+",'','',0,'鑷姩缁戝畾',"+oItemSub.HInterID+",'',"+oItemSub.HBillNo+",'3710',"+
+	                                                "0,0,"+ oItemSub.HMaterID+","+ oItemSub.HUnitID+","+ oItemSub.HQty+", 0,0,0,0,"+
+	                                                "getdate(),'',"+HBillNo+")");
+                        oCN.RunProc(sql);
+                    }
+                    string sql2 = string.Format(@"Insert Sc_PackUnionBillMain(HYear,HPeriod,HBillType,HInterID,HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID,
+                                                    HRemark,HBacker,HChecker,HMaker,HMakeDate,HUpDater,HCloseMan,HCloseType,HDeleteMan,HICMOInterID,HICMOBillNo,
+                                                    HBarCode_Pack,HMaterID,HUnitID,HWeight,HMWeight,HPWeight,
+                                                    HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo,HBillSubType)
+                                                    values('2022',1,'3783'," + HInterID + ",getdate(),'" + HBillNo + "',1,0,0," +
+                                                        "'鑷姩缁戝畾','','', " + msg3 + ",getdate(),'','',0,'',0,0,'" +
+                                                         HBillNo + "',0,0,0,0,0" + 
+                                                        "0,0,0,0,0,'','','')");
+                    oCN.RunProc(sql2);
+                    oCN.Commit();
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎷艰鐢熸垚鎴愬姛";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鑾峰彇澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/InvokeHelper.cs b/WebAPI/InvokeHelper.cs
index 59d764c..99a11a3 100644
--- a/WebAPI/InvokeHelper.cs
+++ b/WebAPI/InvokeHelper.cs
@@ -9,10 +9,10 @@
 {
     public static class InvokeHelper
     {
-        //private static string CloudUrl = "http://localhost/k3cloud/";//K/3 Cloud 涓氬姟绔欑偣鍦板潃
+        private static string CloudUrl = "http://localhost/k3cloud/";//K/3 Cloud 涓氬姟绔欑偣鍦板潃
         //private static string CloudUrl = "http://60.190.4.42:9002/k3cloud/";//K/3 Cloud 涓氬姟绔欑偣鍦板潃
         //private static string CloudUrl = "http://47.96.97.237/k3cloud/";//K/3 Cloud 涓氬姟绔欑偣鍦板潃
-        private static string CloudUrl = "http://60.190.4.42:9002/K3CLOUD/";//澶忓疂
+        //private static string CloudUrl = "http://60.190.4.42:9002/K3CLOUD/";//澶忓疂
 
         /// <summary>
         /// 鐧婚檰
@@ -23,9 +23,9 @@
             httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc");
 
             List<object> Parameters = new List<object>();
-            Parameters.Add("61b14ea86f5c8a");//璐﹀鏍囩ず
+            Parameters.Add("607e565e718a3c");//璐﹀鏍囩ず
             Parameters.Add("Administrator");//鐢ㄦ埛鍚�
-            Parameters.Add("888888");//瀵嗙爜
+            Parameters.Add("ycy123");//瀵嗙爜
             Parameters.Add(2052);//2052浠h〃涓枃
             httpClient.Content = JsonConvert.SerializeObject(Parameters);
 
@@ -246,6 +246,7 @@
         //鐢熶骇璁㈠崟 鎵ц
         public static string ExcuteOperation(string formId, string opNumber, string content)
         {
+            LogService.Write("鐢熶骇璁㈠崟 鎵ц锛宱pNumber锛� " + opNumber + ",content:" + content);
             HttpClient httpClient = new HttpClient();
             httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExcuteOperation.common.kdsvc");
 
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index f9d1ad9..bef2372 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -967,6 +967,13 @@
             return list;
         }
 
+        public List<Models.ClsQK_PackingBill> getObjectByJson_QK_PackingBill(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Models.ClsQK_PackingBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsQK_PackingBill>>(jsonString);
+            return list;
+        }
+
         /// <summary>
         /// 澶勭悊鏂板妯″叿鏀瑰埗鍏ュ簱鍗曚富琛ㄧ殑json
         /// </summary>
diff --git a/WebAPI/Models/ClsQK_PackingBill.cs b/WebAPI/Models/ClsQK_PackingBill.cs
new file mode 100644
index 0000000..1828284
--- /dev/null
+++ b/WebAPI/Models/ClsQK_PackingBill.cs
@@ -0,0 +1,36 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class ClsQK_PackingBill
+    {
+        public Int64 HMaterID;
+        public string HMaterCode;
+        public string HMaterName;
+        public Int64 HUnitID;
+        public string HUnitName;
+        public Int64 HQty;
+        public Int64 HMinQty;
+        public Int64 HTotalQty;
+        public Int64 HSpsQty;
+        public string HAddress;
+        public string HDate;
+        public string HOutStockQty;
+        public string HInvoiceQty;
+        public string HTaxPrice;
+        public string HPrice;
+        public string HMoney;
+        public Int64 HCusID;
+        public string HCusName;
+        public Int64 HEmpID;
+        public string HEmpName;
+        public string HWeight;
+        public string HMWeight;
+        public string HPWeight;
+        public Int64 HInterID;
+        public string HBillNo;
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index c644126..34d7495 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -515,6 +515,7 @@
     <Compile Include="InvokeHelper.cs" />
     <Compile Include="Log.cs" />
     <Compile Include="Models\ClsGy_StockCheckItemBill.cs" />
+    <Compile Include="Models\ClsQK_PackingBill.cs" />
     <Compile Include="Models\ClsSb_EquipRepairSendWorkBillMain.cs" />
     <Compile Include="Models\ClsSb_EquipRepairSendWorkBillSub.cs" />
     <Compile Include="Models\ClsSb_MouldRepairWorkBillMain.cs" />

--
Gitblit v1.9.1