From c87cf9a415a98d71b83f6a00a9c6e9cd8bc18b8d Mon Sep 17 00:00:00 2001
From: 杨乐 <yang.le.192@qq.com>
Date: 星期二, 28 十二月 2021 20:16:44 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WarM/条码打印/Gy_BarCodeBill.cs |  211 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 199 insertions(+), 12 deletions(-)

diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
index 164b9d3..7987c2b 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
@@ -156,6 +156,7 @@
         public Int64 HInterID = 0;      //鍐呯爜
         public Int64 HOrgID = -1;
         public string HOrgNumber = "";
+        public string ERPMode = ""; //ERP妯″紡锛圵ISE銆丆LOUD锛�
         public string CampanyName = ""; //瀹㈡埛瀹氬埗鍖栧悕绉�
         public string SourceQtyCtl = ""; //瓒呮簮鍗曟暟閲忔帶鍒�
                                          //-------------------------------------------------------------------------
@@ -373,6 +374,7 @@
             }
             else
             {
+                ERPMode = oSystemParameter.omodel.WMS_WMSStockCtl_ERPMode;
                 CampanyName = oSystemParameter.omodel.WMS_CampanyName;
                 SourceQtyCtl = oSystemParameter.omodel.BarCode_SourceQtyCtl;
             }
@@ -975,6 +977,7 @@
             grdSub.RowCount = 0;
             grdMain.ColumnCount = 60;                       //鎬诲垪鏁�
             DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name);
+            grdMain.Columns[HSnoCol].HeaderText = "搴忓彿";
             grdMain.Columns[HMainIDCol].HeaderText = "婧愬崟涓籌D";
             grdMain.Columns[HSubIDCol].HeaderText = "婧愬崟瀛怚D";
             grdMain.Columns[HBillNoCol].HeaderText = "婧愬崟鍗曞彿";
@@ -1027,7 +1030,6 @@
             grdMain.Columns[HInnerBillNoCol].HeaderText = "鍐呴儴閲囪喘璁㈠崟鍙�";
             grdMain.Columns[HMakerCol].HeaderText = "鍒跺崟浜�";
             ////
-            grdMain.Columns[HSnoCol].HeaderText = "搴忓彿";
             //鏍煎紡鍖� 
             grdMain.Columns[HTagCol].Visible = false;                           //闅愯棌鍒�
             grdMain.Columns[HMainIDCol].Visible = false;
@@ -1037,8 +1039,8 @@
             grdMain.Columns[HModelCol].Visible = false;
             //grdMain.Columns[HBatchNoCol].Visible = false;
             grdMain.Columns[HAuxPropIDCol].Visible = false;
-            grdMain.Columns[HAuxPropNumberCol].Visible = false;
-            grdMain.Columns[HAuxPropNameCol].Visible = false;
+            //grdMain.Columns[HAuxPropNumberCol].Visible = false;
+            //grdMain.Columns[HAuxPropNameCol].Visible = false;
             grdMain.Columns[HUnitIDCol].Visible = false;
             grdMain.Columns[HinitQtyCol].Visible = false;
             grdMain.Columns[HSupIDCol].Visible = false;
@@ -1153,8 +1155,8 @@
             grdSub.Columns[HMaterID2Col].Visible = false;
             grdSub.Columns[HModel2Col].Visible = false;
             grdSub.Columns[HAuxPropID2Col].Visible = false;
-            grdSub.Columns[HAuxPropNumber2Col].Visible = false;
-            grdSub.Columns[HAuxPropName2Col].Visible = false;
+            //grdSub.Columns[HAuxPropNumber2Col].Visible = false;
+            //grdSub.Columns[HAuxPropName2Col].Visible = false;
             grdSub.Columns[HUnitID2Col].Visible = false;
             grdSub.Columns[HPrintCol].Visible = false;
             grdSub.Columns[HSourceInterID2Col].Visible = false;
@@ -1336,6 +1338,7 @@
             }
             DAL.ClsIF_Material_View oMater = new DAL.ClsIF_Material_View();//鐗╂枡
             DAL.ClsIF_Unit_View oUnit = new DAL.ClsIF_Unit_View();//璁¢噺鍗曚綅
+            DAL.ClsIF_Property_View oProperty = new DAL.ClsIF_Property_View();//杈呭姪灞炴��
             if (!grdStatus)
             {
                 return;
@@ -1368,6 +1371,9 @@
                                         grdMain.Rows[sRow].Cells[HMinQtyCol].Value = oMater.omodel.HQtyMin;
                                         grdMain.Rows[sRow].Cells[HDateCol].Value = dtpHDate.Value.ToShortDateString();
                                         grdMain.Rows[sRow].Cells[HShowDateCol].Value = dtpHDate.Value.ToShortDateString();
+                                        grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0;
+                                        grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = "";
+                                        grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = "";
                                         if (oUnit.GetInfoByID(oMater.omodel.HUnitID))
                                         {
                                             grdMain.Rows[sRow].Cells[HUnitIDCol].Value = oUnit.omodel.HItemID.ToString();
@@ -1392,6 +1398,9 @@
                                         grdMain.Rows[sRow].Cells[HUnitIDCol].Value = 0;
                                         grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = "";
                                         grdMain.Rows[sRow].Cells[HUnitNameCol].Value = "";
+                                        grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0;
+                                        grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = "";
+                                        grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = "";
                                     }
                                 }
                                 else
@@ -1402,6 +1411,11 @@
                                     grdMain.Rows[sRow].Cells[HMaterModelCol].Value = "";
                                     grdMain.Rows[sRow].Cells[HMinQtyCol].Value = 0;
                                     grdMain.Rows[sRow].Cells[HUnitIDCol].Value = 0;
+                                    grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = "";
+                                    grdMain.Rows[sRow].Cells[HUnitNameCol].Value = "";
+                                    grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0;
+                                    grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = "";
+                                    grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = "";
                                 }
                                 break;
 
@@ -1435,6 +1449,31 @@
                             case HDateCol:
                                 BLL.ClsPub_BLL.Sub_SelectDate(grdMain, sRow, HDateCol);
                                 oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HDateCol].Value);
+                                break;
+
+                            case HAuxPropNumberCol:
+                                oProperty.WherePart = "";
+                                if (ERPMode == "CLOUD")
+                                {
+                                    sWhere = " and HMaterNumber = '" + DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[HMaterNumberCol].Value) + "'";
+                                }
+                                else
+                                {
+                                    sWhere = "";
+                                }
+                                if (oProperty.RefreshView(sWhere))
+                                {
+                                    grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = oProperty.oModel.HItemID.ToString();
+                                    grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = oProperty.oModel.HNumber;
+                                    grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = oProperty.oModel.HName;
+                                    oEdit.Text = oProperty.oModel.HNumber;
+                                }
+                                else
+                                {
+                                    grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0;
+                                    grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = "";
+                                    grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = "";
+                                }
                                 break;
 
 
@@ -1742,7 +1781,7 @@
                     grdMain.Rows.Add();
                     Application.DoEvents();
                     //寰楀埌淇℃伅
-                    Ds = oCn.RunProcReturn("select * from h_v_KF_ICInventoryList_IF where hmaterid=" + oSelectRow.BillMainID + " and hwhid=" + oSelectRow.BillSubID + " and hspid=" + oSelectRow.SPID + " and 鎵规='" + oSelectRow.BatchNo + "' and 璁″垝璺熻釜鍙�='" + oSelectRow.BillNo + "'", "h_v_KF_ICInventoryList_IF");
+                    Ds = oCn.RunProcReturn("select * from h_v_KF_ICInventoryList_IF where hmaterid=" + oSelectRow.BillMainID + " and hwhid=" + oSelectRow.BillSubID + " and hspid=" + oSelectRow.SPID + " and HAuxPropID=" + oSelectRow.HAuxPropID + " and 鎵规='" + oSelectRow.BatchNo + "' and 璁″垝璺熻釜鍙�='" + oSelectRow.BillNo + "'", "h_v_KF_ICInventoryList_IF");
                     //鍐欏叆淇℃伅
                     Sub_WriteInForm2(Ds.Tables[0], i);
                 }
@@ -1793,13 +1832,21 @@
             //grdMain.Rows[i].Cells[HSourceNumberCol].Value = oTable.Rows[0]["鐢熶骇绾夸唬鐮�"].ToString();
             grdMain.Rows[i].Cells[HSourceNameCol].Value = oTable.Rows[0]["鐢熶骇绾�"].ToString();
             grdMain.Rows[i].Cells[HEndDateCol].Value = oTable.Rows[0]["璁″垝瀹屽伐鏃ユ湡"].ToString();
-            grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["鏈�灏忓寘瑁呮暟"].ToString(); 
+            if (cmbHBarCodeType.Text == "鎵规鏉$爜" && CampanyName == "鍗氭棩绉戞妧")
+            {
+                grdMain.Rows[i].Cells[HMinQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["鏈敓鎴愭潯鐮佹暟閲�"]);
+            }
+            else
+            {
+                grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["鏈�灏忓寘瑁呮暟"].ToString();
+            }
             //--
             //璁剧疆鍙紪杈戝垪
             string sAllowCol = HQtyCol.ToString() +
+                                "," + HMinQtyCol.ToString() +
+                                "," + HAuxPropNumberCol.ToString() +
                                 "," + HBatchNoCol.ToString() +
-                                "," + HRemarkCol.ToString() +
-                                "," + HMinQtyCol.ToString();
+                                "," + HRemarkCol.ToString();
             grdMain.Columns[HBillNoCol].ReadOnly = true;
             //璁剧疆鍚堣鍒�
             string sTotalCol = HQtyCol.ToString();
@@ -1842,7 +1889,14 @@
             grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["璁¢噺鍗曚綅"].ToString();
             grdMain.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["澶囨敞"].ToString();
             grdMain.Rows[i].Cells[HMTONoCol].Value = oTable.Rows[0]["璁″垝璺熻釜鍙�"].ToString();
-            grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["鏈�灏忓寘瑁呮暟"].ToString(); 
+            if (cmbHBarCodeType.Text == "鎵规鏉$爜" && CampanyName == "鍗氭棩绉戞妧")
+            {
+                grdMain.Rows[i].Cells[HMinQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["鏈敓鎴愭潯鐮佹暟閲�"]);
+            }
+            else
+            {
+                grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["鏈�灏忓寘瑁呮暟"].ToString();
+            }
             grdMain.Rows[i].Cells[HMakerCol].Value = ClsPub.CurUserName;
             if (cmbSourceBillType.Text.Trim() == "鏀舵枡閫氱煡鍗�"|| cmbSourceBillType.Text.Trim() == "閲囪喘璁㈠崟"
                 || cmbSourceBillType.Text.Trim() == "濮斿璁㈠崟" || cmbSourceBillType.Text.Trim() == "閲囪喘鍏ュ簱鍗�")
@@ -1870,9 +1924,10 @@
             //--
             //璁剧疆鍙紪杈戝垪
             string sAllowCol = HQtyCol.ToString() +
+                                "," + HMinQtyCol.ToString() +
+                                "," + HAuxPropNumberCol.ToString() +
                                 "," + HBatchNoCol.ToString() +
-                                "," + HRemarkCol.ToString() +
-                                "," + HMinQtyCol.ToString();
+                                "," + HRemarkCol.ToString();
             grdMain.Columns[HBillNoCol].ReadOnly = true;
             //璁剧疆鍚堣鍒�
             string sTotalCol = HQtyCol.ToString();
@@ -2430,6 +2485,138 @@
             }
         }
 
+        //鎵规鎸夐挳
+        private void BatchNo_Click(object sender, EventArgs e)
+        {
+            lblCaption.Focus();
+            bool b = false;
+            for (int i = 0; i < grdMain.RowCount; i++)
+            {
+                long HMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value);          // 鐗╂枡鍐呯爜
+                string HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HBatchNoCol].Value);     // 鎵瑰彿
+
+                if (HMaterID != 0)
+                {
+                    DataSet oDs = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_GetBatchNo " + HMaterID.ToString() + ",'" + HBatchNo + "','" + dtpHDate.Value.ToShortDateString() + "','" + CampanyName + "'", "h_p_Gy_BarCodeBill_GetBatchNo");
+                    //
+                    if (oDs == null && oDs.Tables[0].Rows.Count == 0)
+                    {
+                        MessageBox.Show("鐢熸垚鎵规澶辫触锛�");
+                        return;
+                    }
+                    else if (DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0][0]) == "1")
+                    {
+                        grdMain.Rows[i].Cells[HBatchNoCol].Value = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HBatchNo"]);
+                        b = true;
+                    }
+                }
+            }
+            //鏄庣粏琛ㄦ槸鍚︿负闆惰
+            if (b == false)
+            {
+                MessageBox.Show("娌℃湁闇�瑕佺敓鎴愭壒娆$殑鏄庣粏琛岋紒", "鎻愮ず");
+                return;
+            }
+        }
+
+        private void txtHSourceBillNo_KeyPress(object sender, KeyPressEventArgs e)
+        {
+            if (e.KeyChar == (char)Keys.Return)//鍥炶溅甯﹀嚭婧愬崟淇℃伅
+            {
+                long sHOrgID = -1;
+                DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View();
+                if (oClsGy_ORGANIZATIONS_View.GetInfoByName(cmbHOrgID.Text))
+                {
+                    sHOrgID = oClsGy_ORGANIZATIONS_View.omodel.HItemID;
+                }
+
+                if (txtHSourceBillNo.Text.Length < 4)
+                {
+                    MessageBox.Show("璇疯緭鍏�4浣嶄互涓婃暟鎹紒");
+                    return;
+                }
+                //鏍规嵁婧愬崟绫诲瀷 鍜屾簮鍗曞彿 鑾峰彇淇℃伅
+                if (cmbSourceBillType.Text.Trim() == "鐢熶骇璁㈠崟")
+                {
+                    DAL.Cls_S_IFCLD_ICMOList oIFCLD_ICMOList = new DAL.Cls_S_IFCLD_ICMOList();
+                    if (oIFCLD_ICMOList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' and HOrgID =" + sHOrgID.ToString()))  //閫夋嫨鍘熷崟
+                    {
+                        FillSelectData(oIFCLD_ICMOList.oBillSelectColl);
+                        txtHSourceBillNo.Text = "";
+                    }
+                    else
+                    {
+                        MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
+                        return;
+                    }
+                }
+                else if (cmbSourceBillType.Text.Trim() == "鐢熶骇姹囨姤鍗�")
+                {
+                    DAL.Cls_S_IF_ICMOReportBillList oIF_ICMOReportBillList = new DAL.Cls_S_IF_ICMOReportBillList();
+                    if (oIF_ICMOReportBillList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' "))  //閫夋嫨鍘熷崟
+                    {
+                        FillSelectData(oIF_ICMOReportBillList.oBillSelectColl);
+                        txtHSourceBillNo.Text = "";
+                    }
+                    else
+                    {
+                        MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
+                        return;
+                    }
+                }
+                else if (cmbSourceBillType.Text.Trim() == "鏀舵枡閫氱煡鍗�")
+                {
+                    DAL.Cls_S_IF_POInStockBillList oIF_POInStockBillList = new DAL.Cls_S_IF_POInStockBillList();
+                    if (oIF_POInStockBillList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' "))  //閫夋嫨鍘熷崟
+                    {
+                        FillSelectData(oIF_POInStockBillList.oBillSelectColl);
+                        txtHSourceBillNo.Text = "";
+                    }
+                    else
+                    {
+                        MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
+                        return;
+                    }
+                }
+                else if (cmbSourceBillType.Text.Trim() == "閲囪喘璁㈠崟")
+                {
+                    DAL.Cls_S_IF_POOrderBillList oIF_POOrderBillList = new DAL.Cls_S_IF_POOrderBillList();
+                    if (oIF_POOrderBillList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' "))  //閫夋嫨鍘熷崟
+                    {
+                        FillSelectData(oIF_POOrderBillList.oBillSelectColl);
+                        txtHSourceBillNo.Text = "";
+                    }
+                    else
+                    {
+                        MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
+                        return;
+                    }
+                }
+                else if (cmbSourceBillType.Text.Trim() == "濮斿璁㈠崟")
+                {
+                    DAL.Cls_S_IF_EntrustOrderBillList oIF_EntrustOrderBillList = new DAL.Cls_S_IF_EntrustOrderBillList();
+                    if (oIF_EntrustOrderBillList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' "))  //閫夋嫨鍘熷崟
+                    {
+                        FillSelectData(oIF_EntrustOrderBillList.oBillSelectColl);
+                        txtHSourceBillNo.Text = "";
+                    }
+                    else
+                    {
+                        MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
+                        return;
+                    }
+                }
+                else
+                {
+                    MessageBox.Show("鎵�閫夋簮鍗曠被鍨嬶紝涓嶆敮鎸佹鍔熻兘锛�");
+                    return;
+                }
+
+            }
+        }
+
+
+
 
 
 

--
Gitblit v1.9.1