瀏覽代碼

包装电子秤示数读取

callm 3 年之前
父節點
當前提交
0d951a4260

+ 1 - 1
UAS_MES_YD/FunctionCode/Make/Make_FeedingCollectionCombineFix.cs

@@ -147,7 +147,7 @@ namespace UAS_MES_NEW.Make
                                 sql.Append("left join stepproduct on sp_stepcode=mcd_stepcode and sp_mothercode = ma_prodcode left join ");
                                 sql.Append("makeserial on ms_makecode=ma_code and sp_craftcode=ms_craftcode left join (select * from ");
                                 sql.Append("BEFOREHANDPROCESS where bhp_maincode='" + code.Text + "') on sp_fsoncode=bhp_prodcode ");
-                                sql.Append("where ma_code='" + ma_code.Text + "' and mcd_stepcode = '" + User.CurrentStepCode + "' and ms_sncode='" + sn_code.Text + "' and bhp_barcode is not null");
+                                sql.Append("where ma_code='" + ma_code.Text + "' and mcd_stepcode = '" + User.CurrentStepCode + "' and sp_bomversion='"+ ma_bomversion .Text+ "' and ms_sncode='" + sn_code.Text + "' and bhp_barcode is not null");
                                 DataTable combinedata = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                                 //如果绑定的料和上料的料数量一样则可以上料
                                 DataTable be_dt = BaseUtil.filterDataTable(dt1, "sp_ifbeforhandle='是'");

+ 1 - 1
UAS_MES_YD/FunctionCode/Make/Make_Repair.cs

@@ -266,7 +266,7 @@ namespace UAS_MES_NEW.Make
                             //sql.Append("sp_craftcode=v_v_mscraftcode and sp_stepcode='' And sp_mothercode ='"+ms_prodcode.Text+"' and sp_tracekind=1");
                             sql.Append("and not exists(select 1 from craftmaterial where cm_sncode in (select '" + firstsn + "' from dual union ");
                             sql.Append("select sn from makesnrelation where firstsn='" + firstsn + "') and cm_makecode='" + macode + "' and ");
-                            sql.Append("cm_fsoncode=sp_fsoncode and cm_status=0) and instr((select ms_paststep from makeserial where ms_firstsn='" + firstsn + "'),sp_stepcode)>0 order by SP_DETNO asc");
+                            sql.Append("cm_fsoncode=sp_fsoncode and cm_status=0) and instr((select ms_paststep from makeserial where ms_firstsn='" + firstsn + "' and ms_makecode='"+ macode + "'),sp_stepcode)>0 order by SP_DETNO asc");
                             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                             if (dt.Rows.Count > 0)
                             {

+ 2 - 2
UAS_MES_YD/FunctionCode/Packing/Packing_PackageCollection1.cs

@@ -308,7 +308,7 @@ namespace UAS_MES_NEW.Packing
                                 //如果勾选了自动生成箱号,在封箱或者首次
                                 if (AutoGenBoxCode.Checked && (pa_status.Text == "1" || pa_status.Text == "" || pa_status.Text == "0"))
                                 {
-                                    pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PACKAGE", ms_makecode, pr_code.Text, User.UserCode);
+                                    pa_outboxcode.Text = LogicHandler.GetOutBoxCode1("PACKAGE", ms_makecode, pr_code.Text, User.UserCode);
                                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "卡通箱采集", "卡通箱" + pa_outboxcode.Text + "自动生成", sn_code.Text, PreFix.Text + ":" + OutBoxLength.Text);
                                 }
                             }
@@ -387,7 +387,7 @@ namespace UAS_MES_NEW.Packing
                                     pa_outboxcode.Text = "";
                                     pa_status.Text = "0";
                                     BaseUtil.CleanDGVData(PackageDetail);
-                                    pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PACKAGE", ms_makecode, pr_code.Text, User.UserCode);
+                                    pa_outboxcode.Text = LogicHandler.GetOutBoxCode1("PACKAGE", ms_makecode, pr_code.Text, User.UserCode);
                                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "卡通箱采集", "卡通箱" + pa_outboxcode.Text + "自动生成", sn_code.Text, PreFix.Text + ":" + OutBoxLength.Text);
                                 }
                                 if (!CheckOutBoxLength(ms_salecode_text))

+ 7 - 7
UAS_MES_YD/FunctionCode/Packing/Packing_PackageCollectionWeigh.cs

@@ -13,6 +13,7 @@ using System.IO.Ports;
 using System.IO;
 using System.Text.RegularExpressions;
 using System.Collections.Generic;
+using Seagull.BarTender.Print;
 
 namespace UAS_MES_NEW.Packing
 {
@@ -23,7 +24,7 @@ namespace UAS_MES_NEW.Packing
         LogStringBuilder sql = new LogStringBuilder();
         AutoSizeFormClass asc = new AutoSizeFormClass();
         Document doc;
-        ApplicationClass lbl;
+        Engine engine;
         Thread thread;
         DataTable Dbfind;
         string ErrorMessage = "";
@@ -40,7 +41,7 @@ namespace UAS_MES_NEW.Packing
 
         string ActWeigh = "0";
 
-        Regex re = new Regex("\\d+.\\d+\\w+");
+        Regex re = new Regex("\\d+.\\w+");
 
         decimal StandardQTY = 0;
 
@@ -64,7 +65,7 @@ namespace UAS_MES_NEW.Packing
         {
             try
             {
-                lbl = new ApplicationClass();
+                engine = new Engine(true);
                 BaseUtil.WriteLbl();
             }
             catch (Exception ex)
@@ -137,7 +138,7 @@ namespace UAS_MES_NEW.Packing
                                 pa_remark.AppendText(weigh + "\n");
                                 if (weigh != "")
                                 {
-                                    weight.Text = weigh;
+                                    weight.Text = re.Match(weigh).Value; ;
                                 }
                             }
                             catch (Exception)
@@ -224,7 +225,7 @@ namespace UAS_MES_NEW.Packing
                 {
                     dh.ExecuteSql("update package set pa_printcount=pa_printcount+1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
                     //doc = lbl.Documents.Open(PrintLabel.Text);
-                    if (Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), oMakeCode == "" ? pa_makecode.Text : oMakeCode, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
+                    if (Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), oMakeCode == "" ? pa_makecode.Text : oMakeCode, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
                     {
                         OperateResult.AppendText(">>开始打印箱号" + pa_outboxcode.Text + "\n", Color.Black);
                     }
@@ -571,7 +572,7 @@ namespace UAS_MES_NEW.Packing
 
         private void pr_code_TextChanged(object sender, EventArgs e)
         {
-            LoadCheckQTY();
+            LoadCheckQTY(); 
             dt = (DataTable)dh.ExecuteSql("select la_id,substr(la_url,instr(la_url,'\\',-1)+1)la_name,la_url,la_isdefault from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='卡通箱标' and la_statuscode='AUDITED' order by la_isdefault", "select");
             PrintLabel.DataSource = dt;
             PrintLabel.DisplayMember = "la_url";
@@ -580,7 +581,6 @@ namespace UAS_MES_NEW.Packing
 
         private void Make_PackageCollectionWeigh_FormClosing(object sender, FormClosingEventArgs e)
         {
-            BaseUtil.ClosePrint(lbl);
             if (serialPort1.IsOpen)
             {
                 GetData = false;

+ 6 - 4
UAS_MES_YD/FunctionCode/Special/Special_CancelCollection.cs

@@ -24,7 +24,7 @@ namespace UAS_MES_NEW.Special
         private void Confirm_Click(object sender, EventArgs e)
         {
             //获取序列号的途程
-            DataTable dt = (DataTable)dh.ExecuteSql("select ms_id,ms_nextstepcode,ms_currentstepcode,ms_makecode,ms_status,ms_checkno,ms_craftcode,ms_prodcode,ms_stepcode from makeserial where ms_sncode='" + sn_code.Text + "' and ms_makecode='" + ms_makecode.Text + "' order by ms_id desc", "select");
+            DataTable dt = (DataTable)dh.ExecuteSql("select ms_firstsn,ms_id,ms_nextstepcode,ms_currentstepcode,ms_makecode,ms_status,ms_checkno,ms_craftcode,ms_prodcode,ms_stepcode from makeserial where ms_sncode='" + sn_code.Text + "' and ms_makecode='" + ms_makecode.Text + "' order by ms_id desc", "select");
             if (dt.Rows.Count > 0)
             {
                 string pr_code = dt.Rows[0]["ms_prodcode"].ToString();
@@ -36,6 +36,7 @@ namespace UAS_MES_NEW.Special
                 string ms_status = dt.Rows[0]["ms_status"].ToString();
                 string ms_currentstepcode = dt.Rows[0]["ms_currentstepcode"].ToString();
                 string ms_id = dt.Rows[0]["ms_id"].ToString();
+                string ms_firstsn = dt.Rows[0]["ms_firstsn"].ToString();
                 sql.Clear();
                 sql.Append("select cd_stepcode from craft left join craftdetail on cr_id=cd_crid where ");
                 sql.Append("cr_prodcode='" + pr_code + "' and cr_code='" + cr_code + "' order by cd_detno ");
@@ -48,11 +49,11 @@ namespace UAS_MES_NEW.Special
                 {
                     sqls.Add("delete from makebad where mb_sncode='" + sn_code.Text + "' and mb_makecode='" + ms_makecode + "'");
                     //更新MakeCraftDetail表记录
-                    sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1 where mcd_macode='" + ms_makecode + "' and instr((select ms_paststep from makeserial where ms_sncode='" + sn_code.Text + "'),mcd_stepcode)>0 ");
+                    sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1 where mcd_macode='" + ms_makecode + "' and instr((select ms_paststep from makeserial where ms_sncode='" + sn_code.Text + "' and ms_makecode='" + ms_makecode + "'),mcd_stepcode)>0 ");
                 }
                 else
                 {
-                    sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1,mcd_okqty=mcd_okqty-1 where mcd_macode='" + ms_makecode + "' and instr((select ms_paststep from makeserial where ms_sncode='" + sn_code.Text + "'),mcd_stepcode)>0 ");
+                    sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1,mcd_okqty=mcd_okqty-1 where mcd_macode='" + ms_makecode + "' and instr((select ms_paststep from makeserial where ms_sncode='" + sn_code.Text + "' and ms_makecode='" + ms_makecode + "'),mcd_stepcode)>0 ");
                 }
                 if (ms_checkno != "")
                 {
@@ -88,11 +89,12 @@ namespace UAS_MES_NEW.Special
                 //删除老化记录
                 sqls.Add("delete from AGINGRECORD where ar_sncode='" + sn_code.Text + "' and ar_macode='" + ms_makecode + "'");
                 //解除前一工单板的使用
-                sqls.Add("update makeserial set ms_nextmacode='' where ms_sncode='" + sn_code.Text + "' and ms_nextmacode='" + ms_makecode + "'");
+                sqls.Add("update makeserial set ms_nextmacode='' where ms_firstsn='" + ms_firstsn + "' and ms_nextmacode='" + ms_makecode + "'");
                 //初始化导入数据状态
                 sqls.Add("update makesnlist set msl_status=0 where msl_sncode='" + sn_code.Text + "' and msl_makecode='" + ms_makecode + "' and msl_type='before'");
                 ////初始化号段状态
                 sqls.Add("update MAKESNRULEDETAIL set msd_status=0 where msd_sncode='" + sn_code.Text + "' and msd_makecode='" + ms_makecode + "'  and msd_type='before'");
+                sqls.Add("delete from  makesnrelation where SN='" + sn_code.Text + "' and makecode='" + ms_makecode + "' ");
                 //清除操作日志
                 //sqls.Add("delete from commandlog where cl_makecode='" + ms_makecode + "' and cl_sncode='" + sn_code.Text + "'");
                 //删除过站记录

+ 8 - 0
UAS_MES_YD/PublicMethod/LogicHandler.cs

@@ -1061,6 +1061,14 @@ namespace UAS_MES_NEW.PublicMethod
             return param[4];
         }
 
+        public static string GetOutBoxCode1(string Caller, string iMakeCode, string iProdCode, string iUserCode)
+        {
+            string BoxCode = "";
+            string[] param = new string[] { Caller, iMakeCode, iProdCode, iUserCode, BoxCode };
+            dh.CallProcedure("SP_GETPACKORPALLETCODE_TEST", ref param);
+            return param[4];
+        }
+
         public static bool CheckSNBeforeLoad(string iMakeCode, string iSN, string iFSonCode, string iSonCode, string iRule, string iPrefix, string iLength, string iIfRepeat, string iChecksalecode, out string ErrMessage)
         {
             DataTable dt;

+ 4 - 1
UAS_MES_YD/PublicMethod/Print.cs

@@ -214,8 +214,11 @@ namespace UAS_MES_NEW.PublicMethod
         {
             ErrorMessage = "";
             DataTable dt = new DataTable();
-            if (IfRePrint != "-1" && SystemInf.CurrentDB == "HAOQ")
+            if (IfRePrint != "-1" && SystemInf.CurrentDB == "HAOQ"&&LabelType!="栈板标")
             {
+                if (LabelType == "") {
+
+                }
                 if (LabelType == "卡通箱标" || LabelType == "大箱标" || LabelType == "栈板标")
                 {
                     dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_type='" + LabelType + "' and lpl_stepcode='" + User.CurrentStepCode + "'", "select");