From 09844d2ce0c99bfcf7698581f9393a2ac1fc3e15 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期二, 11 四月 2023 00:01:04 +0800
Subject: [PATCH] 生成条码--最小包装数;选工序带出车间,工作中心

---
 WebAPI/Controllers/仓存管理/条码生成/Sc_BarCodeController.cs |  174 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 171 insertions(+), 3 deletions(-)

diff --git "a/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Sc_BarCodeController.cs" "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Sc_BarCodeController.cs"
index 044e63c..cb0f9a4 100644
--- "a/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Sc_BarCodeController.cs"
+++ "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Sc_BarCodeController.cs"
@@ -259,6 +259,34 @@
         }
         #endregion
 
+        #region [閫氳繃鏉$爜缂栧彿鑾峰彇HItemId]
+        [Route("Sc_BarCode/Get_HItemId")]
+        [HttpGet]
+        public object Get_HItemId(string sWhere)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                ds = oCN.RunProcReturn("select * from h_v_IF_BarCodeBillList where 鏉$爜缂栧彿 =  '" + sWhere + "'", "h_v_IF_BarCodeBillList");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
         #region [閫氳繃閫夋嫨鐨勬簮鍗曚俊鎭煡鎵炬簮鍗曟暟鎹甝
         [Route("Sc_BarCode/SelectReportFromBillList")]
         [HttpPost]
@@ -387,6 +415,7 @@
                 ordrlist.HPinfan = dt.Rows[i]["HPinfan"].ToString();
                 ordrlist.HSourceName = dt.Rows[i]["鐢熶骇绾�"].ToString();
                 ordrlist.HEndDate = dt.Rows[i]["璁″垝瀹屽伐鏃ユ湡"].ToString();//鍗氭棩 鐢熶骇璁㈠崟 澶辨晥鏃ユ湡
+                ordrlist.HMinQty = dt.Rows[i]["鏈�灏忓寘瑁呮暟"].ToString();
                 if (HBarCodeType == "浠櫒澶栬喘浠舵潯鐮佸鍣ㄨ鍒�")
                 {
                     ordrlist.HMinQty = dt.Rows[i]["鏈敓鎴愭潯鐮佹暟閲�"].ToString();
@@ -428,6 +457,14 @@
                 ordrlist.HUnitName = dt.Rows[i]["璁¢噺鍗曚綅"].ToString();
                 ordrlist.HRemark = dt.Rows[i]["澶囨敞"].ToString();
                 ordrlist.HMTONo = dt.Rows[i]["璁″垝璺熻釜鍙�"].ToString();
+
+                if(HSourceBillType == "鏀舵枡閫氱煡鍗�")
+                {
+                    ordrlist.HFurnaceNO = dt.Rows[i]["鐐夊彿"].ToString();
+                    ordrlist.HCoilNO = dt.Rows[i]["閽㈠嵎鎹嗗寘鍙�"].ToString();
+                    ordrlist.HheatNO = dt.Rows[i]["鐑鐞�"].ToString();
+                }
+
                 if (HBarCodeType == "浠櫒澶栬喘浠舵潯鐮佸鍣ㄨ鍒�")
                 {
                     ordrlist.HMinQty = dt.Rows[i]["鏈敓鎴愭潯鐮佹暟閲�"].ToString();
@@ -478,6 +515,73 @@
             return ordrlist;
         }
 
+        #endregion
+
+        #region [鍚屾璧勬枡]
+        [Route("Sc_BarCode/Sync_data")]
+        [HttpGet]
+        public object Sync_data()
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            try
+            {
+                oCn.RunProc("exec h_p_IF_ERPDataToLocal", ref DBUtility.ClsPub.sExeReturnInfo);
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍚屾鍩虹璧勬枡鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍚屾鍩虹璧勬枡澶辫触锛�" + e;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region [鎵规]
+        [Route("Sc_BarCode/Batch")]
+        [HttpGet]
+        public object Batch(int HMaterID, string HBatchNo)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            bool b = false;
+            if (HMaterID != 0)
+            {
+                DataSet oDs = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_GetBatchNo " + HMaterID.ToString() + ",'" + HBatchNo + "','" + "" + "','" + "" + "'", "h_p_Gy_BarCodeBill_GetBatchNo");
+                //
+                if (oDs == null && oDs.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.Message="鐢熸垚鎵规澶辫触锛�";
+                    return objJsonResult;
+                }
+                else if (DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0][0]) == "1")
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.Message = "鐢熸垚鎵规鎴愬姛锛�";
+                    objJsonResult.data = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HBatchNo"]);
+                    HBatchNo = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HBatchNo"]);
+                    b = true;
+                    return objJsonResult;
+                }
+            }
+            //鏄庣粏琛ㄦ槸鍚︿负闆惰
+            if (b == false)
+            {
+                objJsonResult.code = "1";
+                objJsonResult.Message="娌℃湁闇�瑕佺敓鎴愭壒娆$殑鏄庣粏琛岋紒";
+                return objJsonResult;
+            }
+            else //瀹屽叏灏侀棴
+            {
+                return null;
+            }
+        }
         #endregion
 
         #region [鏉$爜鐢熸垚鎺ュ彛]
@@ -536,7 +640,7 @@
             }
             return objJsonResult;
         }
-        #endregion
+        #endregion        
 
         #region[鍗曟嵁瀹屾暣鎬у垽鏂璢
         private bool Sub_AllowSave(string msg2, string HSelectBarCodeType)
@@ -613,6 +717,13 @@
             int k = 0;
             int n = 0;                  //鍚屼竴鎵圭敓鎴愭潯鐮佷腑鐨勭鍑犳潯
             string sTMNumber = "";      //鏉$爜鑷畾涔夊墠缂�
+
+            string HCoilNO = "";
+            string HFurnaceNO = "";
+            string HFactory = "";
+            decimal HAuxQty = 0;
+            string HheatNO = "";
+
             DataSet Ds;
             msg2 = msg2.Replace("\\", "");
             msg2 = msg2.Replace("\n", "");  //\n
@@ -625,6 +736,12 @@
                     HNumber = DBUtility.ClsPub.isStrNull(ordrlist[j].HMaterID);
                     HMaterNumber = DBUtility.ClsPub.isStrNull(ordrlist[j].HMaterNumber);
                     HBatchNo = ClsPub.isStrNull(ordrlist[j].HBatchNo);
+
+                    HCoilNO = ClsPub.isStrNull(ordrlist[j].HCoilNO);
+                    HFurnaceNO = ClsPub.isStrNull(ordrlist[j].HFurnaceNO);
+                    HFactory = ClsPub.isStrNull(ordrlist[j].HFactory);
+                    HAuxQty = ClsPub.isLong(ordrlist[j].HAuxQty);
+                    HheatNO = ClsPub.isStrNull(ordrlist[j].HheatNO);
                     //鏃ユ湡鑾峰彇鏂瑰紡
                     sDate = DateTime.Now.ToString();
                     //
@@ -895,6 +1012,12 @@
                         barcode.HInnerBillNo2 = ordrlist[j].HInnerBillNo;
                         barcode.HMaker2 = ordrlist[j].HMaker;
                         barcode.HGiveAwayFlag2 = ordrlist[j].HGiveAwayFlag;
+
+                        barcode.HCoilNO = ordrlist[j].HCoilNO;
+                        barcode.HFurnaceNO = ordrlist[j].HFurnaceNO;
+                        barcode.HFactory = ordrlist[j].HFactory;
+                        barcode.HAuxQty = ordrlist[j].HAuxQty;
+                        barcode.HheatNO = ordrlist[j].HheatNO;
                         ListRows.Add(barcode);
                         k = k + 1;
                         n = n + 1;
@@ -935,6 +1058,14 @@
             string HInnerBillNo = "";
             bool HGiveAwayFlag = false;
             Int64 HEntryID = 0;
+
+            string HCoilNO2 = "";
+            string HFurnaceNO2 = "";
+            string HFactory2 = "";
+            decimal HAuxQty2 = 0;
+            string HheatNO2 = "";
+            DateTime HProduceDate;
+            DateTime HExpiryDate;
             try
             {
                 oCN.BeginTran();
@@ -979,6 +1110,14 @@
                         HSeOrderBillNo = ClsPub.isStrNull(ListRows[i].HSeOrderBillNo2);
                         HInnerBillNo = ClsPub.isStrNull(ListRows[i].HInnerBillNo2);
                         HGiveAwayFlag = ClsPub.isBool(ListRows[i].HGiveAwayFlag2);
+
+                        HCoilNO2 = ClsPub.isStrNull(ListRows[i].HCoilNO);
+                        HFurnaceNO2 = ClsPub.isStrNull(ListRows[i].HFurnaceNO);
+                        HFactory2 = ClsPub.isStrNull(ListRows[i].HFactory);
+                        HAuxQty2 = ClsPub.isLong(ListRows[i].HAuxQty);
+                        HheatNO2 = ClsPub.isStrNull(ListRows[i].HheatNO);
+                        HProduceDate = ClsPub.isDate(ListRows[i].HProduceDate);
+                        HExpiryDate = ClsPub.isDate(ListRows[i].HExpiryDate);
                         oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                                     ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
                                     ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
@@ -986,7 +1125,8 @@
                                     ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
                                     ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
                                     ",HGiveAwayFlag " +
-                                    ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
+                                    ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" +
+                                    ",HCoilNO,HFurnaceNO,HFactory,HAuxQty,HheatNO,HProduceDate,HExpiryDate " +
                                     ") values ("
                                     + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
                                     + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
@@ -995,7 +1135,7 @@
                                     + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'"
                                     + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString() + "," + HEntryID.ToString() + ""
                                     + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag)
-                                    + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "')");
+                                    + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "','" + HCoilNO2 + "','" + HFurnaceNO2 + "','" + HFactory2 + "'," + HAuxQty2 + ",'" + HheatNO2 + "','" + HProduceDate + "','" + HExpiryDate + "'" + ")");
 
 
                         //HNumber = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterID2Col].Value);
@@ -1066,6 +1206,34 @@
         }
         #endregion
 
+        #region[鏉$爜鎵撳嵃鏇存柊鎵撳嵃娆℃暟]
+        /// <summary>
+        /// 鏇存柊鎵撳嵃娆℃暟
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <param name="msg2"></param>
+        /// <returns></returns>
+        [Route("Sc_BarCode/UpdateBarcodePrintQty")]
+        [HttpPost]
+        public object UpdateBarcodePrintQty(string msg)
+        {
+            try
+            {
+                oCN.RunProc("update Gy_BarCodeBill set HPrintQty=isnull(HPrintQty,0)+1 where HitemID in("+msg+")", ref DBUtility.ClsPub.sExeReturnInfo);
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鏇存柊鎵撳嵃娆℃暟鎴愬姛";
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵撳嵃澶辫触!鎵撳嵃缁撴潫 锛�" + e.ToString();
+                return objJsonResult;
+            }
+        }
+        #endregion
 
         #endregion
     }

--
Gitblit v1.9.1