Эх сурвалжийг харах

标签异常重启,修改EN获取顺序

callm 22 цаг өмнө
parent
commit
228cd5db9e

+ 1 - 0
UAS_MES_HYSX/DataOperate/DataHelper.cs

@@ -516,6 +516,7 @@ namespace UAS_MES_NEW.DataOperate
         {
             object result = null;
             command = new OracleCommand(SQL, connection);
+            Console.WriteLine(SQL);
             Reconnect(command);
             //用来拼接参数的
             if (names.Length > 0)

+ 5 - 3
UAS_MES_HYSX/FunctionCode/Make/Make_ColorBoxLabelPrintZX.Designer.cs

@@ -376,6 +376,8 @@
             // PrintSecond
             // 
             this.PrintSecond.AutoSize = true;
+            this.PrintSecond.Checked = true;
+            this.PrintSecond.CheckState = System.Windows.Forms.CheckState.Checked;
             this.PrintSecond.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.PrintSecond.ForeColor = System.Drawing.Color.Red;
             this.PrintSecond.Location = new System.Drawing.Point(1458, 411);
@@ -456,7 +458,7 @@
             this.label3.TabIndex = 212;
             this.label3.Text = "份数";
             // 
-            // Make_ColorBoxLabelPrint
+            // Make_ColorBoxLabelPrintZX
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@@ -495,14 +497,14 @@
             this.Controls.Add(this.ms_makecode_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
             this.Margin = new System.Windows.Forms.Padding(6);
-            this.Name = "Make_ColorBoxLabelPrint";
+            this.Name = "Make_ColorBoxLabelPrintZX";
             this.Tag = "Make!ColorBoxLabelPrint";
             this.Text = "W";
             this.Activated += new System.EventHandler(this.Make_ColorBoxLabelPrint_Activated);
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Make_ColorBoxLabelPrint_FormClosing);
             this.Load += new System.EventHandler(this.Make_ColorBoxLabelPrint_Load);
             this.SizeChanged += new System.EventHandler(this.Make_ColorBoxLabelPrint_SizeChanged);
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }

+ 1 - 1
UAS_MES_HYSX/FunctionCode/Make/Make_ColorBoxLabelPrintZX.cs

@@ -204,7 +204,6 @@ namespace UAS_MES_NEW.Make
                             OperateResult.AppendText(">>序列号" + sncode.Text + "所属工单号" + oMakeCode + "与界面工单号" + ma_code.Text + "不同,无法采集\n", Color.Red, sncode);
                             return;
                         }
-                        string dev_no = HttpServer.GetEN(sncode.Text);
                         //获取工单的其他信息
                         sql.Clear();
                         sql.Append("select ma_code,nvl(ma_unlimitin,0)ma_unlimitin,pr_code,pr_detail,pr_spec from  ");
@@ -241,6 +240,7 @@ namespace UAS_MES_NEW.Make
                             sncode.Focus();
                             return;
                         }
+                        string dev_no = HttpServer.GetEN(sncode.Text);
                         //if (int.Parse(mcd_remainqty.Text) <= 0 && dt.Rows[0]["ma_unlimitin"].ToString() == "0")
                         //{
                         //    macode = ma_code.Text;

+ 30 - 24
UAS_MES_HYSX/FunctionCode/Packing/Packing_PackageCollectionYLF.cs

@@ -193,10 +193,11 @@ namespace UAS_MES_NEW.Packing
             //加载Grid数据
             dt = (DataTable)dh.ExecuteSql("select pa_outboxcode,pa_prodcode,pd_barcode,pd_innerqty,pd_makecode,pa_indate from packageDetail left join package on pa_id=pd_paid where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
             BaseUtil.FillDgvWithDataTable(PackageDetail, dt);
-            if (PackageDetail.RowCount > 0) {
+            if (PackageDetail.RowCount > 0)
+            {
                 PackageDetail.FirstDisplayedScrollingRowIndex = PackageDetail.RowCount - 1;
             }
-        
+
             if (dt.Rows.Count > 0)
             {
                 string choose_pd_barcode = dt.Rows[0]["pd_barcode"].ToString();
@@ -268,6 +269,11 @@ namespace UAS_MES_NEW.Packing
             {
                 if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
+                    string str = dh.getFieldDataByCondition("ztedata", "ZD_SN", "ZD_MAC_START='" + sn_code.Text + "'").ToString();
+                    if (str != "")
+                    {
+                        sn_code.Text = str;
+                    }
                     dt = (DataTable)dh.ExecuteSql("select ms_status,ms_id,ms_makecode,ms_nextstepcode,ms_craftcode,ms_prodcode from makeserial where ms_sncode ='" + sn_code.Text + "' order by ms_id desc", "select");
                     if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage) || (dt.Rows.Count > 0 && dt.Rows[0]["ms_status"].ToString() == "2"))
                     {
@@ -420,28 +426,28 @@ namespace UAS_MES_NEW.Packing
                         //如果未勾选了取消录入
                         if (!Cancel.Checked)
                         {
-                            if (inputweight.Text == "")
-                            {
-                                OperateResult.AppendText("请输入重量\n", Color.Green);
-                                inputweight.Focus();
-                                return;
-                            }
-                            double ActualWeight = double.Parse(inputweight.Text == "" ? "0" : inputweight.Text.Replace("kg", "").Replace("g", "").Trim());
-                            if ((ActualWeight >= MinWeight) && (ActualWeight <= MaxWeight))
-                            {
-                                OperateResult.AppendText(">>彩盒" + sn_code.Text + "重量检测检测合格\n", Color.Green);
-                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + inputweight.Text, "称量合格", sn_code.Text, "");
-                                LogicHandler.RecordProdWeight(sn_code.Text, "SN", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
-                                dh.ExecuteSql("update makeserial set ms_grossw='" + ActualWeight + "' where ms_id='" + oMsID + "'", "update");
-                            }
-                            else
-                            {
-                                OperateResult.AppendText(">>彩盒" + sn_code.Text + "重量检测未通过\n", Color.Red);
-                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + inputweight.Text, "称量不合格", sn_code.Text, "");
-                                LogicHandler.RecordProdWeight(sn_code.Text, "SN", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
-                                return;
-                            }
-                            inputweight.Text = "";
+                            //if (inputweight.Text == "")
+                            //{
+                            //    OperateResult.AppendText("请输入重量\n", Color.Green);
+                            //    inputweight.Focus();
+                            //    return;
+                            //}
+                            //double ActualWeight = double.Parse(inputweight.Text == "" ? "0" : inputweight.Text.Replace("kg", "").Replace("g", "").Trim());
+                            //if ((ActualWeight >= MinWeight) && (ActualWeight <= MaxWeight))
+                            //{
+                            //    OperateResult.AppendText(">>彩盒" + sn_code.Text + "重量检测检测合格\n", Color.Green);
+                            //    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + inputweight.Text, "称量合格", sn_code.Text, "");
+                            //    LogicHandler.RecordProdWeight(sn_code.Text, "SN", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
+                            //    dh.ExecuteSql("update makeserial set ms_grossw='" + ActualWeight + "' where ms_id='" + oMsID + "'", "update");
+                            //}
+                            //else
+                            //{
+                            //    OperateResult.AppendText(">>彩盒" + sn_code.Text + "重量检测未通过\n", Color.Red);
+                            //    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "彩盒称重:" + inputweight.Text, "称量不合格", sn_code.Text, "");
+                            //    LogicHandler.RecordProdWeight(sn_code.Text, "SN", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
+                            //    return;
+                            //}
+                            //inputweight.Text = "";
 
                             //判断序列号是否已经装箱
                             string ms_outboxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_id='" + oMsID + "'").ToString();

+ 3 - 3
UAS_MES_HYSX/FunctionCode/Packing/Packing_PackageCollectionZX.cs

@@ -122,8 +122,8 @@ namespace UAS_MES_NEW.Packing
             stw.ShowDialog();
             try
             {
-                OutBoxLength.Text = BaseUtil.GetCacheData("OutBoxLength").ToString();
-                PreFix.Text = BaseUtil.GetCacheData("PreFix").ToString();
+                //OutBoxLength.Text = BaseUtil.GetCacheData("OutBoxLength").ToString();
+                //PreFix.Text = BaseUtil.GetCacheData("PreFix").ToString();
                 Remark_PreFix.Text = BaseUtil.GetCacheData("Remark_PreFix").ToString();
             }
             catch (Exception) { }
@@ -191,7 +191,7 @@ namespace UAS_MES_NEW.Packing
         private void LoadGridData()
         {
             //加载Grid数据
-            dt = (DataTable)dh.ExecuteSql("select pa_outboxcode,pa_prodcode,pd_barcode,pd_innerqty,pd_makecode,pa_indate from packageDetail left join package on pa_id=pd_paid where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
+            dt = (DataTable)dh.ExecuteSql("select pa_outboxcode,pa_prodcode,pd_barcode,pd_innerqty,pd_makecode,pa_indate from packageDetail left join package on pa_id=pd_paid where pa_outboxcode='" + pa_outboxcode.Text + "' order by pd_barcode", "select");
             BaseUtil.FillDgvWithDataTable(PackageDetail, dt);
             if (PackageDetail.RowCount > 0)
             {

+ 2 - 2
UAS_MES_HYSX/FunctionCode/Packing/Packing_PalletCollectionZX.cs

@@ -67,8 +67,8 @@ namespace UAS_MES_NEW.Packing
             SetLoadingWindow stw = new SetLoadingWindow(thread, "初始化打印程序");
             BaseUtil.SetFormCenter(stw);
             stw.ShowDialog();
-            OutBoxLength.Text = BaseUtil.GetCacheData("PalletLength").ToString();
-            PalletPreFix.Text = BaseUtil.GetCacheData("PalletPreFix").ToString();
+            //OutBoxLength.Text = BaseUtil.GetCacheData("PalletLength").ToString();
+            //PalletPreFix.Text = BaseUtil.GetCacheData("PalletPreFix").ToString();
             dh = SystemInf.dh;
             StepCount.StepCode = User.CurrentStepCode;
             StepCount.Source = User.UserSourceCode;

+ 10 - 6
UAS_MES_HYSX/PublicMethod/HttpServer.cs

@@ -71,7 +71,8 @@ namespace UAS_MES_NEW.PublicMethod
         public List<BindItem> BindList { get; set; }
     }
 
-    public class RootObjectYS {
+    public class RootObjectYS
+    {
         [JsonProperty("nub")]
         public string nub { get; set; }
 
@@ -416,7 +417,10 @@ namespace UAS_MES_NEW.PublicMethod
             switch (status)
             {
                 case "-1":
-                    BaseUtil.ShowError("未获取到EN号");
+                    if (dev_en_no == "")
+                    {
+                        BaseUtil.ShowError("该序号已入库");
+                    }
                     break;
                 case "-2":
                     BaseUtil.ShowError("没有写入这个序号的设备");
@@ -512,10 +516,10 @@ namespace UAS_MES_NEW.PublicMethod
         {
             dynamic obj = new ExpandoObject();
             var expandoDict = obj as IDictionary<string, object>;
-            DataTable dt = (DataTable)dh.ExecuteSql("select NOTYPE,po_sn,ma_custpo,pd_barcode,pd_makecode,ZD_D_SN from packagedetail left join ZTEDATA on zd_makecode=pd_makecode and pd_barcode=ZD_DEV_EN_NO left join make on ma_code=pd_makecode left join ZTE_ORDER on ma_custpo=BATCH_NO  where pd_outboxcode='" + iBox + "' and  RESERVE9='" + User.UserLineCode + "'", "select");
+            DataTable dt = (DataTable)dh.ExecuteSql("select nvl(NOTYPE,0)NOTYPE,po_sn,ma_custpo,pd_barcode,pd_makecode,ZD_D_SN from packagedetail left join ZTEDATA on zd_makecode=pd_makecode and pd_barcode=zd_sn left join make on ma_code=pd_makecode left join ZTE_ORDER on ma_custpo=BATCH_NO  where pd_outboxcode='" + iBox + "' and  RESERVE9='" + User.UserLineCode + "'", "select");
             string makecode = "";
             string po = "";
-            string notype = "";
+            int notype =0;
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 string enNoKey = $"en_no{i}";
@@ -523,7 +527,7 @@ namespace UAS_MES_NEW.PublicMethod
                 expandoDict[enNoKey] = enNoValue;
                 makecode = dt.Rows[i]["pd_makecode"].ToString();
                 po = dt.Rows[i]["po_sn"].ToString();
-                notype = dt.Rows[i]["NOTYPE"].ToString();
+                notype =int.Parse( dt.Rows[i]["NOTYPE"].ToString());
             }
             obj.request = "Q_wai_xiang";
             obj.packing_num = dt.Rows.Count;
@@ -654,7 +658,7 @@ namespace UAS_MES_NEW.PublicMethod
             dh.ExecuteSql("insert into EISDATA(ED_ID, ED_DATA, ED_INDATE, ED_TYPE)values(EISDATA_seq.nextval,'" + returnstr + "',sysdate,'SendPowerCode')", "insert");
         }
 
-        public static async void SendBoxDataYS(string iBox) 
+        public static async void SendBoxDataYS(string iBox)
         {
             DataTable dt = (DataTable)dh.ExecuteSql("select ma_custpo,ma_custpodetno,ZD_BIG_BOX_NO,pr_code,PRODUCT_MODE,ms_makecode,po_sn from makeserial left join product on ms_prodcode=pr_code left join make on ma_code=ms_makecode left join zte_order on ma_custpo=batch_no left join ztedata on ZD_DEV_EN_NO=ms_sncode and zd_makecode=ms_makecode where ms_outboxcode ='" + iBox + "' and zd_type='BOX' order by ms_id desc", "select");
             var root = new RootObjectYS

+ 9 - 1
UAS_MES_HYSX/PublicMethod/Print.cs

@@ -574,7 +574,15 @@ namespace UAS_MES_NEW.PublicMethod
                 MessageBox.Show("打印文件不存在");
                 return false;
             }
-            doc2 = lbl.Formats.Open(@"C:\打印标签\" + LabelName);
+            try
+            {
+                doc2 = lbl.Formats.Open(@"C:\打印标签\" + LabelName);
+            }
+            catch (System.Exception)
+            {
+                lbl = new BarTender.Application();
+                doc2 = lbl.Formats.Open(@"C:\打印标签\" + LabelName);
+            }
             if (doc2 == null)
             {
                 MessageBox.Show("标签文件打开失败");