Explorar o código

Merge branch 'master' of ssh://10.10.101.21/source/mes-client

Hcsy %!s(int64=8) %!d(string=hai) anos
pai
achega
1ef0e90827

+ 6 - 5
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.cs

@@ -131,7 +131,7 @@ namespace UAS_MES.Make
                             }
                             sql.Clear();
                             sql.Append("select sp_id,sp_tracekind,sp_barcoderule,sp_ifuseregex,sp_ifforsn,sp_length,sp_soncode,sp_repcode");
-                            sql.Append(",pr_id,sp_type,sp_prefix,sp_regex from stepproduct left join product on pr_code=sp_soncode where ");
+                            sql.Append(",pr_id,sp_type,sp_prefix,sp_regex,sp_fsoncode from stepproduct left join product on pr_code=sp_soncode where ");
                             sql.Append("sp_bomversion='" + ma_bomversion.Text + "' and sp_craftcode='" + ma_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "'");
                             sql.Append("And sp_mothercode ='" + pr_code.Text + "' and((( sp_tracekind <> 2 or sp_tracekind is null))or sp_type <> '物料')");
                             sql.Append("and not exists(select 1 from craftmaterial where (cm_sncode='" + ms_firstsn + "' or cm_sncode in (select sn from makesnrelation where firstsn='" + ms_firstsn + "')) and cm_makecode='" + ma_code.Text + "' and cm_soncode=");
@@ -140,7 +140,7 @@ namespace UAS_MES.Make
                             //获取对应 产品的机身标的打印模板
                             if (ListA.Rows.Count > 0)
                             {
-                                OperateResult.AppendText(">>请采集" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n");
+                                OperateResult.AppendText(">>请采集" + ListA.Rows[RemainIndex]["sp_fsoncode"].ToString() + "或" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n");
                                 code.Clear();
                             }
                             else
@@ -196,6 +196,7 @@ namespace UAS_MES.Make
                     {
                         //获取上料需要传递的参数,sp_soncode,sp_id
                         string sp_soncode = ListA.Rows[RemainIndex]["sp_soncode"].ToString();
+                        string sp_fsoncode = ListA.Rows[RemainIndex]["sp_fsoncode"].ToString();
                         string sp_prefix = ListA.Rows[RemainIndex]["sp_prefix"].ToString();
                         string sp_regex = ListA.Rows[RemainIndex]["sp_regex"].ToString();
                         string length = ListA.Rows[RemainIndex]["sp_length"].ToString();
@@ -203,7 +204,7 @@ namespace UAS_MES.Make
                         string sp_ifforsn = ListA.Rows[RemainIndex]["sp_ifforsn"].ToString();
                         string sp_tracekind = ListA.Rows[RemainIndex]["sp_tracekind"].ToString();
                         string sp_barcoderule = ListA.Rows[RemainIndex]["sp_barcoderule"].ToString();
-                        if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
+                        if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
                         {
                             CollectData.Add(code.Text);
                             SPID.Add(sp_id);
@@ -218,7 +219,7 @@ namespace UAS_MES.Make
                         }
                         code.Clear();
                         if (RemainIndex <= ListA.Rows.Count - 1)
-                            OperateResult.AppendText(">>请采集物料编号为" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n");
+                            OperateResult.AppendText(">>请采集物料编号为" + ListA.Rows[RemainIndex]["sp_fsoncode"].ToString() + "或" + ListA.Rows[RemainIndex]["sp_soncode"].ToString() + "的条码\n");
                         if (RemainIndex == ListA.Rows.Count)
                         {
                             sql.Clear();
@@ -229,7 +230,7 @@ namespace UAS_MES.Make
                             sql.Append("'" + User.UserSourceCode + "',:sp_id,0,1,ms_firstsn from make left join makecraftdetail on mcd_macode=ma_code  left join stepproduct on sp_stepcode=mcd_stepcode ");
                             sql.Append("and sp_craftcode=ma_craftcode and sp_mothercode = ma_prodcode left join makeserial on ms_makecode=ma_code ");
                             sql.Append("where ma_code='" + ma_code.Text + "'and sp_id=:sp_id1 and mcd_stepcode = '" + User.CurrentStepCode + "' and ms_sncode='" + ms_sncode.Text + "'");
-                            dh.BatchInsert(sql.GetString(), new string[] { "soncode", "barcode","sp_id","sp_id1" }, CollectDataSonCode.ToArray(), CollectData.ToArray(),SPID.ToArray(),SPID.ToArray());
+                            dh.BatchInsert(sql.GetString(), new string[] { "soncode", "barcode", "sp_id", "sp_id1" }, CollectDataSonCode.ToArray(), CollectData.ToArray(), SPID.ToArray(), SPID.ToArray());
                             //更新半成品SN已被工单使用
                             dh.ExecuteSql("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_id=(select max(ms_id) from makeserial where ms_sncode='" + ms_sncode.Text + "' and ms_makecode<>'" + ma_code.Text + "')", "update");
                             OperateResult.AppendText(">>序列号" + ms_sncode.Text + "对应的物料已经采集完成\n", Color.Green);

+ 3 - 2
UAS-MES/FunctionCode/Make/Make_Decompose.cs

@@ -217,7 +217,7 @@ namespace UAS_MES.Make
                             dtbar = new DataTable();
                             sql.Clear();
                             sql.Append("select sp_id,sp_tracekind,sp_barcoderule,sp_prefix,sp_ifuseregex,sp_ifforsn,sp_length,sp_description,sp_soncode,pr_detail,pr_spec,");
-                            sql.Append("sp_repcode,pr_id,sp_type,case when (sp_type='物料' and sp_soncode=pr_code) then '已采集' else '未采集' end sp_ifpick ,sp_prefix,");
+                            sql.Append("sp_repcode,sp_fsoncode,pr_id,sp_type,case when (sp_type='物料' and sp_soncode=pr_code) then '已采集' else '未采集' end sp_ifpick ,sp_prefix,");
                             sql.Append("sp_length,sp_regex,sp_ifforsn from stepproduct left join product on pr_code=sp_soncode where sp_bomversion='" + ma_bomversion + "' and ");
                             sql.Append("sp_craftcode='" + LabelDataGridView.Rows[i].Cells["cm_craftcode"].Value + "'and sp_mothercode ='" + LabelDataGridView.Rows[i].Cells["cm_maprodcode"].Value + "' and sp_soncode = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "' ");
                             sql.Append("and((sp_type = '物料')or sp_type <> '物料') order by SP_DETNO asc");
@@ -228,12 +228,13 @@ namespace UAS_MES.Make
                                 string sp_tracekind = dtbar.Rows[0]["sp_tracekind"].ToString();
                                 string sp_soncode = dtbar.Rows[0]["sp_soncode"].ToString();
                                 string sp_prefix = dtbar.Rows[0]["sp_prefix"].ToString();
+                                string sp_fsoncode = dtbar.Rows[0]["sp_fsoncode"].ToString();
                                 string length = dtbar.Rows[0]["sp_length"].ToString();
                                 string sp_barcoderule = dtbar.Rows[0]["sp_barcoderule"].ToString();
                                 if (sp_tracekind != "2")
                                 {
                                     //上料校验规则判断
-                                    if (!LogicHandler.CheckSNBeforeLoad(ms_makecode.Text, LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
+                                    if (!LogicHandler.CheckSNBeforeLoad(ms_makecode.Text, LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
                                     {
                                         OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                                         LoadData(sncode_1, sender, new KeyEventArgs(Keys.Enter));

+ 5 - 4
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -135,6 +135,7 @@ namespace UAS_MES.Make
                                 return;
                             }
                             string sp_soncode = dt1.Rows[RemainIndex]["sp_soncode"].ToString();
+                            string sp_fsoncode = dt1.Rows[RemainIndex]["sp_fsoncode"].ToString();
                             string sp_prefix = dt1.Rows[RemainIndex]["sp_prefix"].ToString();
                             string sp_regex = dt1.Rows[RemainIndex]["sp_regex"].ToString();
                             string length = dt1.Rows[RemainIndex]["sp_length"].ToString();
@@ -142,7 +143,7 @@ namespace UAS_MES.Make
                             string sp_ifforsn = dt1.Rows[RemainIndex]["sp_ifforsn"].ToString();
                             string sp_tracekind = dt1.Rows[RemainIndex]["sp_tracekind"].ToString();
                             string sp_barcoderule = dt1.Rows[RemainIndex]["sp_barcoderule"].ToString();
-                            if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
+                            if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
                                 Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
                             else
                                 OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
@@ -308,7 +309,7 @@ namespace UAS_MES.Make
             dt1 = new DataTable();
             sql.Clear();
             sql.Append("select sp_id,sp_tracekind,sp_barcoderule,sp_ifuseregex,sp_ifforsn,sp_length,sp_soncode,sp_repcode");
-            sql.Append(",pr_id,sp_type,sp_prefix,sp_regex from stepproduct left join product on pr_code=sp_soncode where ");
+            sql.Append(",pr_id,sp_type,sp_prefix,sp_fsoncode,sp_regex from stepproduct left join product on pr_code=sp_soncode where ");
             sql.Append("sp_bomversion='" + mabomversion + "' and sp_craftcode='" + ms_craftcode + "' and sp_stepcode='" + User.CurrentStepCode + "'");
             sql.Append("And sp_mothercode ='" + make_prodcode + "' and((( sp_tracekind <> 2 or sp_tracekind is null))or sp_type <> '物料')");
             sql.Append("and not exists(select 1 from craftmaterial where (cm_sncode='" + ms_firstsn + "' or cm_sncode in (select sn from makesnrelation where firstsn='" + ms_firstsn + "')) and cm_makecode='" + ma_code.Text + "' and cm_soncode=");
@@ -318,13 +319,13 @@ namespace UAS_MES.Make
             //用于记录提醒的数据长度
             RemainList = new string[dt1.Rows.Count];
             for (int i = 0; i < dt1.Rows.Count; i++)
-                RemainList[i] = dt1.Rows[i]["sp_soncode"].ToString();
+                RemainList[i] = dt1.Rows[i]["sp_fsoncode"].ToString() + "或" + dt1.Rows[i]["sp_soncode"].ToString();
             if (dt1.Rows.Count > 0)
             {
                 try
                 {
                     CollectDataSonCode.Add(dt1.Rows[RemainIndex]["sp_soncode"].ToString());
-                    OperateResult.AppendText("<<请采集" + dt1.Rows[RemainIndex]["sp_soncode"].ToString() + "的" + dt1.Rows[RemainIndex]["sp_type"].ToString() + "数据\n", Color.Black);
+                    OperateResult.AppendText("<<请采集" + dt1.Rows[RemainIndex]["sp_fsoncode"].ToString() + "或" + dt1.Rows[RemainIndex]["sp_soncode"].ToString() + "的" + dt1.Rows[RemainIndex]["sp_type"].ToString() + "数据\n", Color.Black);
                 }
                 catch (Exception)
                 {

+ 4 - 4
UAS-MES/PublicMethod/LogicHandler.cs

@@ -294,7 +294,7 @@ namespace UAS_MES.PublicMethod
             //取MakeProcess表中的执行记录ID最大的一个工单的号码
             oMakeCode = "";
             oErrorMessage = "";
-            oMakeCode = dh.getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id=(select max(ms_id) from makeserial where ms_sncode='"+iSnCode+"')").ToString();
+            oMakeCode = dh.getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id=(select max(ms_id) from makeserial where ms_sncode='" + iSnCode + "')").ToString();
             if (oMakeCode != "")
                 return true;
             else
@@ -1097,7 +1097,7 @@ namespace UAS_MES.PublicMethod
             return param[4];
         }
 
-        public static bool CheckSNBeforeLoad(string iMakeCode, string iSN, string iSonCode, string iRule, string iPrefix, string iLength, out string ErrMessage)
+        public static bool CheckSNBeforeLoad(string iMakeCode, string iSN, string iFSonCode, string iSonCode, string iRule, string iPrefix, string iLength, out string ErrMessage)
         {
             DataTable dt;
             ErrMessage = "";
@@ -1140,8 +1140,8 @@ namespace UAS_MES.PublicMethod
                     dt = (DataTable)dh.ExecuteSql("select bar_prodcode,bar_code from barcode where bar_code='" + iSN + "'", "select");
                     if (dt.Rows.Count > 0)
                     {
-                        if (iSonCode != dt.Rows[0]["bar_prodcode"].ToString())
-                            ErrMessage = "用户条码号对应的物料不是:" + iSonCode;
+                        if (iSonCode != dt.Rows[0]["bar_prodcode"].ToString() && iFSonCode != dt.Rows[0]["bar_prodcode"].ToString())
+                            ErrMessage = "用户条码号对应的物料不是:" + iSonCode + "或" + iFSonCode;
                         else
                             return true;
                     }