From a09ff1d01aeebae9037118035f10e06c570b092e Mon Sep 17 00:00:00 2001
From: ch <37327@LLOOCCY>
Date: 星期三, 19 一月 2022 08:46:34 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs b/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs
index 9520fd8..fb0bd06 100644
--- a/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs
+++ b/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs
@@ -1,5 +1,6 @@
 锘縰sing System;
 using System.Collections.Generic;
+using System.Data;
 using System.Linq;
 using System.Web;
 
@@ -89,6 +90,21 @@
         {
             try
             {
+                //鑾峰彇褰撳墠宸ュ簭宸ュ簭鍙蜂互鍙婂垽鏂槸鍚︽湯閬撳伐搴�
+                string sql = string.Format(@"select max(b.HProcNo) HProcNo  from Sc_ProcessPlanMain a
+                               inner join   Sc_ProcessPlanSub  b on a.HInterID=b.HInterID  
+                               where b.HSourceBillNo='" + omodel.HSourceBillNo+"' and b.HSourceInterID='"+omodel.HSourceInterID+"'  and b.HSourceEntryID='"+omodel.HSourceEntryID+"'");
+                DataSet ds= oCn.RunProcReturn(sql, "Sc_ProcessPlanMain");
+                //鏌ヨ鏈�澶у伐搴忓強鍒ゆ柇褰撳墠宸ュ簭鏄惁灏忎簬鏈�澶у伐搴�
+                if (ds.Tables[0].Rows.Count > 0 && int.Parse(ds.Tables[0].Rows[0]["HProcNo"].ToString()) > omodel.HProcID)
+                {
+                    omodel.HProcNo = omodel.HProcNo + 5;
+                }
+                else 
+                {
+                    omodel.HProcNo = omodel.HProcNo + 5; //鏈亾宸ュ簭搴忓彿鍔�5
+                }
+
                 //寰楀埌mainid
                 omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
@@ -114,6 +130,21 @@
                     "," + omodel.HDeptID.ToString() + "," + omodel.HWorkerID.ToString() + "," + omodel.HQty.ToString() + ",'" + omodel.HPlanBeginDate.ToString() +"',"+ omodel.HSourceInterID.ToString()+
                     ","+ omodel.HSourceEntryID.ToString()+",'"+ omodel.HSourceBillNo+"','"+ omodel.HSourceBillType+","+ omodel.HSourceID.ToString()+
                      ") ");
+                //鏂板鐢熶骇鐘舵�佷复鏃惰〃
+                string sql1 = string.Format(@"insert into Sc_ICMOBillStatus_Tmp(HYear,HPeriod,HBillType,HDate,HDeptID,HICMOInterID,HICMOEntryID,HICMOBillNo,HYX,HSplitNO,HICMOStatus,HMaterID
+                                    ,HMaterNumber,HUnitID,HUnitNumber,HSourceID,HSourceNumber,HSplitPlanQty,HSplitRelationQty,HDatePlanQty
+                                    ,HUnitFinishQty,HDateFinishQty,HBadQty,HUnitBadQty,HWasterQty,HSumTimes,HFinishFlag,HCurWorkFlag,HCurQualityFlag
+                                    ,HBeginDate,HEndDate,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo
+                                    ,HSourceBillType,HRelationInterID,HEnoughMaterFlag,HProcID,HPlanQty)
+                                    select HYear,HPeriod,HBillType,HDate,HDeptID,HICMOInterID,HICMOEntryID,HICMOBillNo,HYX,HSplitNO,HICMOStatus,HMaterID
+                                    ,HMaterNumber,HUnitID,HUnitNumber,HSourceID,HSourceNumber,HPlanQty,HSplitPlanQty,HSplitRelationQty,HDatePlanQty
+                                    ,HUnitFinishQty,HDateFinishQty,HBadQty,HUnitBadQty,HWasterQty,HSumTimes,HFinishFlag,HCurWorkFlag,HCurQualityFlag
+                                    ,HBeginDate,HEndDate,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo
+                                    ,HSourceBillType,HRelationInterID,HEnoughMaterFlag,HProcID,'"+omodel.HQty.ToString()+"' " +
+                                    "from Sc_ICMOBillStatus_Tmp where HSourceBillNo='"+omodel.HSourceBillNo.ToString()+"'" +
+                                    " and HSourceInterID='"+omodel.HSourceInterID+"' and HSourceEntryID='"+omodel.HMainSourceEntryID.ToString()+"'" +
+                                    " and HSourceID='"+omodel.HSourceID.ToString()+"' and HProcID='"+omodel.HProcID.ToString()+"'");
+                oCn.RunProc(sql);
                 sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;

--
Gitblit v1.9.1