callm 2 недель назад
Родитель
Сommit
cf398579b8
1 измененных файлов с 15 добавлено и 1 удалено
  1. 15 1
      UAS-MES/FunctionCode/Special/Special_Reset.cs

+ 15 - 1
UAS-MES/FunctionCode/Special/Special_Reset.cs

@@ -49,10 +49,23 @@ namespace UAS_MES.Special
             BaseUtil.SetFormValue(this.Controls, Dbfind);
             BaseUtil.SetFormValue(this.Controls, Dbfind);
         }
         }
 
 
-        private void ReSN(string sncode, string stepcode)
+        private bool ReSN(string sncode, string stepcode)
         {
         {
+            DataTable dt = (DataTable)dh.ExecuteSql("select ms_makecode,MS_OUTNO from makeserial left join product on pr_code=ms_prodcode where ms_sncode ='" + sncode + "' order by ms_id desc", "select");
+
+            if (!dt.Rows[0]["ms_paststep"].ToString().Contains(cd_stepcode.Text))
+            {
+                OperatResult.AppendText(">>序列号" + sncode + "不允许回流到未执行工序\n", Color.Red);
+                return false;
+            }
+            if (dt.Rows[0]["MS_OUTNO"].ToString() != "")
+            {
+                OperatResult.AppendText(">>序列号" + sncode + "已出货"+ dt.Rows[0]["MS_OUTNO"].ToString() + "不允许回流\n", Color.Red);
+                return false;
+            }
             string stname = dh.getFieldDataByCondition("step", "st_name", "st_code = '" + stepcode + "'").ToString();
             string stname = dh.getFieldDataByCondition("step", "st_name", "st_code = '" + stepcode + "'").ToString();
             dh.ExecuteSql("update makeserial set MS_STEPCODE = '',MS_CHECKNO ='', ms_status=1,ms_outboxcode='',ms_nextstepcode= '" + stepcode + "' where ms_sncode='" + sncode + "' and ms_makecode='" + ms_makecode.Text + "'", "update");
             dh.ExecuteSql("update makeserial set MS_STEPCODE = '',MS_CHECKNO ='', ms_status=1,ms_outboxcode='',ms_nextstepcode= '" + stepcode + "' where ms_sncode='" + sncode + "' and ms_makecode='" + ms_makecode.Text + "'", "update");
+
             //if (checkBox1.Checked)
             //if (checkBox1.Checked)
             //{
             //{
             //    dh.ExecuteSql("update makeserial set ms_bs = '',ms_key='',ms_keyid='',MS_HARDWREID='',MS_KEYSTATEID='',MS_BIOS='',ms_ec='',ms_uuid='',MS_KEYPARTNUMBER='',ms_bt='',ms_mac='',ms_imei='' where ms_sncode = '" + sncode + "' and ms_makecode = '" + ms_makecode.Text + "'", "update");
             //    dh.ExecuteSql("update makeserial set ms_bs = '',ms_key='',ms_keyid='',MS_HARDWREID='',MS_KEYSTATEID='',MS_BIOS='',ms_ec='',ms_uuid='',MS_KEYPARTNUMBER='',ms_bt='',ms_mac='',ms_imei='' where ms_sncode = '" + sncode + "' and ms_makecode = '" + ms_makecode.Text + "'", "update");
@@ -66,6 +79,7 @@ namespace UAS_MES.Special
             sql.Append("cm_dropsccode='" + User.UserSourceCode + "' where cm_sncode = '" + sncode + "' and cm_stepcode in (select cd_stepcode from craftdetail left join step on st_code=cd_stepcode left join craft on cd_crid=cr_id where ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "' and cr_prodcode='" + ms_prodcode.Text + "' and cd_detno >=" + cd_stepno.Text + " )");
             sql.Append("cm_dropsccode='" + User.UserSourceCode + "' where cm_sncode = '" + sncode + "' and cm_stepcode in (select cd_stepcode from craftdetail left join step on st_code=cd_stepcode left join craft on cd_crid=cr_id where ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "' and cr_prodcode='" + ms_prodcode.Text + "' and cd_detno >=" + cd_stepno.Text + " )");
             dh.ExecuteSql(sql.GetString(), "update");
             dh.ExecuteSql(sql.GetString(), "update");
             LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "站点重置", "重置SN 备注:" + remark.Text + " 站点重置至" + stname, sncode, "");
             LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "站点重置", "重置SN 备注:" + remark.Text + " 站点重置至" + stname, sncode, "");
+            return true;
         }
         }