From bd2d1fb06fe96c991447d87d366e0f7f3024da79 Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期四, 23 十二月 2021 15:44:26 +0800
Subject: [PATCH] nothing

---
 WebAPI/Controllers/生产管理/报工台工序/Sc_MESBeginStepWorkBillController.cs |   94 +++++++++++++++++++++++++++++-----------------
 1 files changed, 59 insertions(+), 35 deletions(-)

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 56123ae..3554f14 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"
@@ -597,15 +597,20 @@
         public static DataSet Sc_GetMESProductReportBillList(string sWhere)
         {
             string sql = string.Format(@"select a.HInterID, a.HBillNo,a.HDate,a.HBillType,a.HBillStatus,a.HMaterID,m.HNumber HMaterCode,m.HName HMaterName,m.HModel HMaterSpec 
-                                   ,a.HSourceID,s.HNumber HSourceCode,s.HName HSourceName,a.HGroupID,g.HNumber HGroupCode,g.HName HGroupName
-                                   ,a.HWorkManID,e.HName HWorkManName,a.HMaker,a.HMakeDate, a.HReportType  
-                                   ,a.HQty,a.HICMOBillNo,a.HICMOInterID,a.HICMOEntryID 
-                                   ,a.HSourceInterID,a.HSourceEntryID,a.HSourceBillNo, a.HSourceBillType
-                                   from Sc_ICMOBillWorkQtyStatus_Tmp a 
-                                   left join Gy_Material m on a.HMaterID=m.hitemid
-                                   left join Gy_Source s on a.HSourceID=s.HItemID
-                                   left join Gy_Group g on a.HGroupID=g.HItemID
-                                   left join Gy_Employee e on a.HWorkManID=e.HItemID " + sWhere + " and HRelationInterID='0'");
+                                         ,b.HSourceID,s.HNumber HSourceCode,s.HName HSourceName,a.HGroupID,g.HNumber HGroupCode,g.HName HGroupName
+                                         ,b.HEmpID,b.HEmpNumber,e.HName HEmpName,a.HMaker,a.HMakeDate, '宸ュ簭姹囨姤' HReportType  
+                                         ,b.HQty,a.HICMOBillNo,a.HICMOInterID,pr.HProcNo,b.HProcID,p.HNumber HProcNumber,p.HName HProcName
+                                         ,b.HSourceInterID,b.HSourceEntryID,b.HSourceBillNo,b.HSourceBillType
+                                         from Sc_ProcessReportMain a 
+                                         inner join Sc_ProcessReportSub b on a.HInterID=B.HInterID
+                                         inner join (select max(HProcNo) HProcNo,HBillNo,HProcID,HSourceInterID,HSourceEntryID,HSourceBillNo 
+                                         from Sc_ProcessPlanSub group by HBillNo,HProcID,HSourceInterID,HSourceEntryID,HSourceBillNo) 
+                                         pr on b.HSourceBillNo=pr.HSourceBillNo and b.HSourceInterID=pr.HSourceInterID and b.HSourceEntryID=pr.HSourceEntryID
+                                         left join Gy_Process p on b.HProcID=p.HItemID
+                                         left join Gy_Material m on a.HMaterID=m.hitemid
+                                         left join Gy_Source s on b.HSourceID=s.HItemID
+                                         left join Gy_Group g on a.HGroupID=g.HItemID
+                                         left join Gy_Employee e on b.HEmpID=e.HItemID "+sWhere+"  and HRelationInterID='0'");
             return new SQLHelper.ClsCN().RunProcReturn(sql, "Sc_ICMOBillWorkQtyStatus_Tmp");
         }
         #endregion
@@ -622,7 +627,7 @@
         {
             try
             {
-                ds = new SQLHelper.ClsCN().RunProcReturn("select isnull(sum(HQty),0) HQty,isnull(sum(HBadQty),0) HBadQty,isnull(sum(HWasterQty),0) HWasterQty   from Sc_ICMOBillWorkQtyStatus_Tmp with (nolock)" + sWhere, "Sc_ICMOBillWorkQtyStatus_Tmp");
+                ds = new SQLHelper.ClsCN().RunProcReturn("select isnull(sum(HQty),0) HQty,isnull(sum(HBadQty),0) HBadQty,isnull(sum(HWasterQty),0) HWasterQty   from Sc_ProcessReportSub with (nolock)" + sWhere, "Sc_ProcessReportSub");
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     objJsonResult.code = "1";
@@ -650,9 +655,9 @@
         }
         #endregion
 
-        #region 鎶ュ伐骞冲彴浜ч噺姹囨姤淇濆瓨/缂栬緫
+        #region 鎶ュ伐骞冲彴宸ュ簭姹囨姤淇濆瓨/缂栬緫
         /// <summary>
-        /// 寮�宸ュ崟
+        /// 宸ュ簭姹囨姤鎻愪氦
         /// </summary>
         /// <param name="msg"></param>
         /// <returns></returns>
@@ -669,12 +674,12 @@
             ListModels oListModels = new ListModels();
             try
             {
-                DLL.ClsSc_ICMOBillWorkQtyStatus_Tmp oBill = new DLL.ClsSc_ICMOBillWorkQtyStatus_Tmp();
-                List<Models.ClsSc_ICMOBillWorkQtyStatus_Tmp> lsmain = new List<Models.ClsSc_ICMOBillWorkQtyStatus_Tmp>();
+                DLL.ClsSc_ProcessReport oBill = new DLL.ClsSc_ProcessReport();
+                List<Models.ClsSc_ProcessReportMain> lsmain = new List<Models.ClsSc_ProcessReportMain>();
                 msg2 = msg2.Replace("\\", "");
                 msg2 = msg2.Replace("\n", "");  //\n
-                lsmain = oListModels.getObjectByJson_Gy_MESProductReportFrom(msg2);
-                foreach (Models.ClsSc_ICMOBillWorkQtyStatus_Tmp oItem in lsmain)
+                lsmain = oListModels.getObjectByJson_ProcessReportMain(msg2);
+                foreach (Models.ClsSc_ProcessReportMain oItem in lsmain)
                 {
                     if (refSav == "Add")
                     {
@@ -725,10 +730,11 @@
                         }
                     }
 
-                    oItem.HBillType = "3724";
-                    oItem.HBillSubType = "3724";
-                    oItem.HReportType = 3;//锛�1鏉$爜鎵弿锛�2鏈哄櫒姹囨姤锛�3鎵嬪伐褰曞叆锛�
+                    oItem.HBillType = "3714";
+                    oItem.HBillSubType = "3714";
                     oItem.HBillStatus = 1;   //鍗曟嵁鐘舵�侊紙1鏈锛�2瀹℃牳閫氳繃锛�3鍏抽棴锛�4浣滃簾锛�5瀹℃牳閫�鍥�,6瀹℃牳涓�,7宸查槄锛�8宸插洖澶嶏紝9缁撴锛�10楠岃瘉,11涓嬭揪锛�12寮�宸�,13鐢宠瀹℃壒,15鐢宠妫�楠岋紝16 鍒ゅ畾鍚堟牸锛�17鍒ゅ畾涓嶅悎鏍硷級     
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                     if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                     {
                         objJsonResult.code = "0";
@@ -738,6 +744,30 @@
                         return objJsonResult;
                     }
                     oBill.omodel = oItem;
+                }
+                //琛ㄤ綋鏁版嵁
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                List<Models.ClsSc_ProcessReportSub> ls = new List<Models.ClsSc_ProcessReportSub>();
+                ls = oListModels.getObjectByJson_ProcessReportSub(msg2);
+                int i = 0;
+                foreach (Models.ClsSc_ProcessReportSub oItemSub in ls)
+                {
+
+                    i++;
+                    oItemSub.HEntryID = i;
+                    //oItemSub.HCloseMan = "";       //琛屽叧闂�
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+                    //oItemSub.HRemark = "";         //澶囨敞
+                    oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+                    //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦
+                    //oItemSub.HRepairID = 0;       //缁翠慨椤圭洰
+                    //oItemSub.HRepairExplanation ="";   //缁翠慨瑕佹眰
+                    //oItemSub.HManagerID = 0;   //璐熻矗浜篒D
+                    //oItemSub.HMoney = 0;        //缁翠慨璐圭敤
+                    oBill.DetailColl.Add(oItemSub);
+
                 }
 
                 //淇濆瓨
@@ -753,7 +783,7 @@
                         string sReturn = "";
                         if (oSystemParameter.ShowBill(ref sReturn) == true)
                         {
-                            if (oSystemParameter.omodel.Sc_ICMOBillWorkQtyStatus_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                            if (oSystemParameter.omodel.Sc_MESProceReportWorkBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
                             {
                                 objJsonResult.Verify = "Y";
                             }
@@ -797,7 +827,7 @@
         }
         #endregion
 
-        #region 鎶ュ伐骞冲彴浜ч噺姹囨姤瀹℃牳銆佸弽瀹℃牳
+        #region 鎶ュ伐骞冲彴宸ュ簭姹囨姤瀹℃牳銆佸弽瀹℃牳
         /// <summary>
         /// 
         /// </summary>
@@ -809,7 +839,7 @@
         [HttpGet]
         public object MESProductAuditProcessReportList(int HSourceID, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, int HICMOInterID, int HICMOEntryID, int HInterID, int IsAudit, string CurUserName)
         {
-            string ModRightNameCheck = "MES_ProcExchReport_Check";
+            string ModRightNameCheck = "MES_ProductReport_Check";
             DBUtility.ClsPub.CurUserName = CurUserName;
             try
             {
@@ -833,7 +863,7 @@
                 }
                 Int64 lngBillKey = 0;
                 lngBillKey = DBUtility.ClsPub.isLong(HInterID);
-                DLL.ClsSc_ICMOBillWorkQtyStatus_Tmp oBill = new DLL.ClsSc_ICMOBillWorkQtyStatus_Tmp();
+                DLL.ClsSc_ProcessReport oBill = new DLL.ClsSc_ProcessReport();
                 //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
                 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
                 {
@@ -887,7 +917,7 @@
                 if (IsAudit == 0) //瀹℃牳鎻愪氦
                 {
                     //瀹℃牳鎻愪氦
-                    if (oBill.CheckBill(HSourceID, HSourceInterID, HSourceEntryID, HSourceBillNo, HICMOInterID, HICMOEntryID, lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;
@@ -907,7 +937,7 @@
                 if (IsAudit == 1) //鍙嶅鏍告彁浜�
                 {
                     //鍙嶅鏍告彁浜bandonCheck
-                    if (oBill.AbandonCheck(HSourceID, HSourceInterID, HSourceEntryID, HSourceBillNo, HICMOInterID, HICMOEntryID, lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;
@@ -945,17 +975,11 @@
             try
             {
                 oCN.BeginTran();
-                //鏌ヨ浜ч噺姹囨姤涓存椂琛ㄦ暟閲�
-                ds = oCN.RunProcReturn("select isnull(HQty,0) HQty,isnull(HWasterQty,0) HWasterQty,isnull(HBadQty,0) HBadQty  from Sc_ICMOBillWorkQtyStatus_Tmp where HInterID='" + HInterID + "' and HICMOInterID='" + HICMOInterID + "' and HICMOEntryID='" + HICMOEntryID + "'", "Sc_ICMOBillWorkQtyStatus_Tmp");
-                double HQty = double.Parse(ds.Tables[0].Rows[0]["HQty"].ToString());
-                double HWasterQty = double.Parse(ds.Tables[0].Rows[0]["HWasterQty"].ToString());
-                double HBadQty = double.Parse(ds.Tables[0].Rows[0]["HBadQty"].ToString());
-                double sumqty = HQty + HBadQty + HWasterQty;  //姹囨姤鏁伴噺+涓嶈壇+鎶ュ簾
-                //鏇存柊浜ч噺瑁呴噺涓存椂琛ㄥ凡姹囨姤鏁伴噺
-                string sql1 = string.Format(@"update Sc_ICMOBillStatus_Tmp  set  HICMOStatus='1',HFinishFlag='0', HRelationInterID=0,HSplitRelationQty=HSplitRelationQty-" + sumqty + ",HDateFinishQty=HDateFinishQty-" + sumqty + "   where  HICMOInterID='" + HICMOInterID + "' and HICMOEntryID='" + HICMOEntryID + "'");
+                //鍒犻櫎宸ュ簭姹囨姤瀛愯〃
+                string sql1 = string.Format(@"delete Sc_ProcessReportSub  where HInterID='"+HInterID+"' and   HICMOInterID='" + HICMOInterID + "' and HICMOEntryID='" + HICMOEntryID + "'");
                 oCN.RunProc(sql1);
-                //鏇存柊鍒囨崲鐘舵�佸��
-                string sql = string.Format(@"delete Sc_ICMOBillWorkQtyStatus_Tmp  where HInterID='" + HInterID + "'");
+                //鍒犻櫎宸ュ簭姹囨姤涓昏〃
+                string sql = string.Format(@"delete Sc_ProcessReportMain  where HInterID='" + HInterID + "'");
                 oCN.RunProc(sql);
 
                 oCN.Commit();

--
Gitblit v1.9.1