From 2cae7ac47f79cbc707be77a5b2563a8f18967ade Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期四, 26 五月 2022 09:14:53 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 DAL/仓库管理/ClsKf_ProductInBill.cs |  137 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 137 insertions(+), 0 deletions(-)

diff --git "a/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_ProductInBill.cs" "b/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_ProductInBill.cs"
index ecfe34f..dc60697 100644
--- "a/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_ProductInBill.cs"
+++ "b/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_ProductInBill.cs"
@@ -579,6 +579,143 @@
         }
 
 
+        //鏈亾宸ュ簭鍑虹珯姹囨姤鍗曞垪琛�   鍏ュ簱鍔熻兘璋冪敤
+        public bool AddBill_StationOut_LastProc(string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
+        {
+            try
+            {
+                DataSet Ds;
+                if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                }
+                else
+                {
+                    oCn.BeginTran();
+                }
+                //鐢熸垚鍑哄叆搴撳崟鎹�
+                //鎻掑叆瀛愯〃
+                DataSet DS2 = oCn.RunProcReturn("EXEC h_p_Kf_ProductInBillSub_Insert_StationOutLastProc " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + sHSourceType + "'", "h_p_Kf_ProductInBillSub_Insert_StationOutLastProc");
+                if (DS2 == null || DS2.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鍒ゆ柇鍐欏叆瀛愯〃鐘舵�佸け璐ワ紝鏈煡閿欒锛�";
+                    if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                    {
+                    }
+                    else
+                    {
+                        oCn.RollBack();
+                    }
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isStrNull(DS2.Tables[0].Rows[0][0]) != "OK")
+                    {
+                        sErrMsg = "鍗曟嵁鍙凤細" + omodel.HBillNo + "锛屽啓鍏ュ瓙琛ㄥけ璐ワ紒";
+                        return false;
+                    }
+                }
+                //鎻掑叆涓昏〃
+                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
+                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
+                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
+                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
+                ") " +
+                " values('1202','1202'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',convert(varchar(10),getdate(),120),'" + omodel.HMainSourceBillType + "'" +
+                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',convert(varchar(10),getdate(),120)" +
+                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
+                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
+                ") ");
+
+                //鏂板K3瀛愯〃銆佷富琛�
+                oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Insert_New " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillerID.ToString() + ",'" + sHSourceType + "'");
+
+                //鏇存柊鍏宠仈鏁伴噺
+                if (sHSourceType == "3710")         //鐢熶骇浠诲姟鍗�
+                {
+                    oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToProductIn_Add " + omodel.HInterID.ToString());
+                    //鍥炲~K3鍏宠仈鏁伴噺
+                    oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateBillRelateData_ICMO_New " + omodel.HInterID.ToString());
+                }
+                else    //鏃犳簮鍗�
+                {
+                    //鍥炲~K3鍏宠仈鏁伴噺
+                    oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateBillRelateData_New " + omodel.HInterID.ToString());
+                }
+
+                //鍒ゆ柇搴撳瓨鏇存柊鎺у埗鐘舵�侊紙0涓哄鏍告敼鍙樺簱瀛橈紝1涓轰繚瀛樻敼鍙樺簱瀛橈級
+                DataSet DS = oCn.RunProcReturn("exec h_p_IFK3_SaveUpdateStock ", "h_p_IFK3_SaveUpdateStock");
+                if (DS == null || DS.Tables[1].Rows.Count == 0)
+                {
+                    sErrMsg = "鍒ゆ柇搴撳瓨鏇存柊鎺у埗鐘舵�侊紝鏈煡閿欒锛�";
+                    if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                    {
+                    }
+                    else
+                    {
+                        oCn.RollBack();
+                    }
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(DS.Tables[1].Rows[0][0]) == 1)
+                    {
+                        //鏇存柊K3搴撳瓨
+                        oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateStock_New " + omodel.HInterID.ToString());
+                        oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateOrderStock_New " + omodel.HInterID.ToString());
+                        //瀹℃牳鍗曟嵁
+                        if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                        {
+                            //瀹℃牳鍗曟嵁
+                            oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + omodel.HInterID.ToString());
+
+                            //瀹℃牳K3鍗曟嵁
+                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Check_New " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
+                        }
+                    }
+                    else
+                    {
+                        //瀹℃牳鍗曟嵁
+                        if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                        {
+                            //瀹℃牳鍗曟嵁
+                            oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + omodel.HInterID.ToString());
+
+                            //瀹℃牳K3鍗曟嵁
+                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Check_New " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
+                            //鏇存柊K3搴撳瓨
+                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateStock_New " + omodel.HInterID.ToString());
+                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateOrderStock_New " + omodel.HInterID.ToString());
+                        }
+                    }
+                }
+
+                sErrMsg = "鏂板鍗曟嵁鎴愬姛锛�";
+                if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                }
+                else
+                {
+                    oCn.Commit();
+                }
+                return true;
+            }
+            catch (Exception e)
+            {
+                sErrMsg = "鐢熸垚浜у搧鍏ュ簱鍗曞け璐ワ紒" + e.Message;
+                if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                }
+                else
+                {
+                    oCn.RollBack();
+                }
+                return false;
+            }
+        }
+
 
 
     }

--
Gitblit v1.9.1