From 1f49f98a07ae1c31a1967c5c36b382d6c855becd Mon Sep 17 00:00:00 2001
From: jhz <jinghz@oceic.com>
Date: 星期二, 26 七月 2022 09:59:37 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/基础资料/基础资料/Gy_StockCheckItemBillController.cs |   92 ++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 77 insertions(+), 15 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 ca17c05..72ad2b7 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"
@@ -211,7 +211,7 @@
                     ")", ref DBUtility.ClsPub.sExeReturnInfo);
                     //淇敼涓婄骇涓洪潪鏈骇浠g爜
                     oCn.RunProc("Update Gy_StockCheckItem set HEndflag=0 where HItemID=" + oBill.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
-
+                   
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
@@ -252,6 +252,46 @@
         }
         #endregion
 
+        #region 鐩樼偣鍒嗘瀽鍒楄〃鍒ゆ柇褰撳墠閫夋嫨鐨勭洏鐐规柟妗堟槸鍚︾敓鎴愯繃鍗曟嵁
+        [Route("Gy_StockCheckItemBill/StockItemSubIsExistence")]
+        [HttpGet]
+        public object StockItemSubIsExistence(string sID)
+        {
+            try
+            {
+                DataSet ds;
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                string sql;
+                sql = string.Format(@"select * from Gy_StockCheckItemSub where HInterID=" + sID);
+                ds = oCN.RunProcReturn(sql, "Gy_StockCheckItemSub");
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏆傛湭鐢熸垚";
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "宸茬敓鎴�";
+                    return objJsonResult;
+                }
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        
+
         #region 鐩樼偣鍒嗘瀽鍒楄〃
         [Route("Gy_StockCheckItemBill/Get_InventoryAnalysisList")]
         [HttpGet]
@@ -263,15 +303,30 @@
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                if (sID == null || sID == "")
+                //鍒ゆ柇鏄惁閫夋嫨鐩樼偣鏂规锛屾槸=>锛堢敤鐩樼偣鏂规瀛愯〃鍋氬姣旓級锛屽惁=>锛堢敤鍣ㄥ叿妗f鍋氬姣旓級
+                if (sID==null|| sID == "")
                 {
-                    sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisList where " + sWhere + " order by HItemID desc ");
+                    if (sWhere=="pk")
+                    {
+                        sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisPK");
+                    }
+                    else
+                    {
+                        sql = string.Format($"exec h_p_Sc_MouldInventoryAnalysisList2  '{sWhere}'");
+                    }
                 }
                 else
                 {
-                    sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisList where " + sWhere + " and HSourceInterID=(select HItemID from Gy_StockCheckItem where HItemID=" + sID + ") and HMakeDate<=(select HEndDate from Gy_StockCheckItem where HItemID=" + sID + ") order by HItemID desc ");
+                    if (sWhere == "pk")
+                    {
+                        sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisPK2 WHERE HInterID="+ sID);
+                    }
+                    else
+                    {
+                        sql = string.Format($"exec h_p_Sc_MouldInventoryAnalysisList  '{sID}','{sWhere}'");
+                    }
                 }
-                ds = oCN.RunProcReturn(sql, "Sc_MouldStockBillMain_Temp");
+                ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldInventoryAnalysisList");
                 list.Add(ds.Tables[0]);
 
                 objJsonResult.code = "1";
@@ -406,6 +461,7 @@
                 {
                     var HBarCode = item.HBarCode;
                     var HItemID = item.HItemID;
+                    string HDate = item.HMakeDate;
                     string HBillNo = "";
                     Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈�
                     DataSet ds1 = new DataSet();
@@ -422,7 +478,7 @@
                     ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                     ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                     ") " +
-                    " values('3814','3814'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
+                    " values('3814','3814'," + HInterID + ",'" + HBillNo + "','" + HDate+"'"+
                     ", '" + user + "',getdate()" +
                     ", " + dr["HSupID"].ToString() + ", 1," + dr["HNowSupID"].ToString() + ",0,0,0,0" +
                     ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
@@ -490,10 +546,11 @@
                     var HBarCode = item.HBarCode;
                     var HItemID = item.HItemID;
                     string HBillNo = "";
+                    string HDate = item.HMakeDate;
                     Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈�
                     DataSet ds1 = new DataSet();
-                    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");
+                    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");
                     DataRow dr = ds.Tables[0].Rows[0];
                     DataRow dr1 = ds1.Tables[0].Rows[0];
                     HInterID = DBUtility.ClsPub.CreateBillID("3827", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -504,18 +561,20 @@
                     ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                     ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                     ") " +
-                    " values('3827','3827'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
+                    " values('3827','3827'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                     ", '" + user + "',getdate()" +
-                    ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" +
-                    ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
+                    ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + ",isnull('" + dr["HNowSupID"].ToString() + "',0),0,0,0,0" +
+                    ", 0," + dr["HDeptID"].ToString() + ",'',0" +
                     ") ";
+                
                     string sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub   (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,
                     HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HPropertyID,HSecUnitRate,HSecUnitID,HUnitID,
                     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() + ",'" + dr["HNowSupID"] + "',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,'')");
+                   
                     //涓昏〃
                     oCn.BeginTran();
                     oCn.RunProc(sql);
@@ -570,6 +629,7 @@
                     var HBarCode = item.HBarCode;
                     var HItemID = item.HItemID;
                     string HBillNo = "";
+                    string HDate = item.HMakeDate;
                     Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈�
                     DataSet ds1 = new DataSet();
                     ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
@@ -585,7 +645,7 @@
                     ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                     ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                     ") " +
-                    " values('3832','3832'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
+                    " values('3832','3832'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                     ", '" + user + "',getdate()" +
                     ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" +
                     ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
@@ -651,6 +711,7 @@
                     var HBarCode = item.HBarCode;
                     var HItemID = item.HItemID;
                     string HBillNo = "";
+                    string HDate = item.HMakeDate;
                     Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈�
                     DataSet ds1 = new DataSet();
                     ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
@@ -666,7 +727,7 @@
                     ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                     ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                     ") " +
-                    " values('3802','3802'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
+                    " values('3802','3802'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                     ", '" + user + "',getdate()" +
                     ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" +
                     ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
@@ -731,6 +792,7 @@
                     var HBarCode = item.HBarCode;
                     var HItemID = item.HItemID;
                     string HBillNo = "";
+                    string HDate = item.HMakeDate;
                     Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈�
                     DataSet ds1 = new DataSet();
                     ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
@@ -746,7 +808,7 @@
                     ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                     ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                     ") " +
-                    " values('3803','3803'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
+                    " values('3803','3803'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                     ", '" + user + "',getdate()" +
                     ", " + dr["HNowSupID"].ToString() + "," + dr["HNowSupTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" +
                     ", 0," + dr["HDeptID"].ToString() + ",' ',0" +

--
Gitblit v1.9.1