|
|
@@ -860,7 +860,8 @@ namespace UAS_MES_NEW.PublicMethod
|
|
|
AutoPassJudge(iSnCode, iMakeCode, iSourceCode, "", LineCode, "", "-1");
|
|
|
}
|
|
|
DataTable dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_stepcode", "nvl(ms_ifrework,0)ms_ifrework", "ms_status", "nvl(ms_ifqccheck,0)ms_ifqccheck" }, "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");
|
|
|
- if (dt.Rows.Count > 0) {
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
string ms_ifqccheck = dt.Rows[0]["ms_ifqccheck"].ToString();
|
|
|
if (ms_ifqccheck != "0")
|
|
|
{
|
|
|
@@ -909,7 +910,8 @@ namespace UAS_MES_NEW.PublicMethod
|
|
|
{
|
|
|
oErrorMessage = iSnCode + "QC抽检状态,不允许采集";
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
if (ifrework == "0")
|
|
|
dh.UpdateByCondition("makeserial", "ms_status=3,ms_nextstepcode=''", "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");
|
|
|
else
|
|
|
@@ -1159,6 +1161,172 @@ namespace UAS_MES_NEW.PublicMethod
|
|
|
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, string iSubNum, string iSubNumLength, out string Resultstr, out string ErrMessage)
|
|
|
+ {
|
|
|
+ DataTable dt;
|
|
|
+ ErrMessage = "";
|
|
|
+ Resultstr = "";
|
|
|
+ switch (iRule)
|
|
|
+ {
|
|
|
+ case "TSN":
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select ms_id,ms_prodcode,ms_nextmacode,ms_salecode,ms_downstatus from makeserial where ms_sncode='" + iSN + "' and ms_makecode<>'" + iMakeCode + "' and ms_status=2 order by ms_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ if (dt.Rows[0]["ms_downstatus"].ToString() != "0")
|
|
|
+ {
|
|
|
+ ErrMessage = "序列号:" + iSN + "已下地,请先取消下地";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (dt.Rows[0]["ms_nextmacode"].ToString() != "")
|
|
|
+ {
|
|
|
+ ErrMessage = "序列号:" + iSN + "已被工单" + dt.Rows[0]["ms_nextmacode"].ToString() + "使用";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if ((dt.Rows[0]["ms_salecode"].ToString() != dh.getFieldDataByCondition("make", "ma_salecode", "ma_code='" + iMakeCode + "'").ToString()) && iChecksalecode != "0")
|
|
|
+ {
|
|
|
+ ErrMessage = "序列号对应销售订单与工单不符";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //ms_salecode是否等于工单的SaleCode
|
|
|
+ if (iSonCode != dt.Rows[0]["ms_prodcode"].ToString())
|
|
|
+ {
|
|
|
+ ErrMessage = "序列号对应的物料不是:" + iSonCode;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else ErrMessage = "序列号" + iSN + "不存在";
|
|
|
+ break;
|
|
|
+ case "BARCODE":
|
|
|
+ if (iIfRepeat != "-1")
|
|
|
+ {
|
|
|
+ //判定条码是否已经上料了
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select cm_barcode from craftmaterial where cm_barcode='" + iSN + "' and cm_status=0", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ ErrMessage = "条码" + iSN + "已经上料";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select bar_prodcode,bar_code from barcode where bar_code='" + iSN + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string bar_prodcode = dt.Rows[0]["bar_prodcode"].ToString();
|
|
|
+ if (!iFSonCode.Contains(bar_prodcode))
|
|
|
+ {
|
|
|
+ if (!iSonCode.Contains(bar_prodcode))
|
|
|
+ {
|
|
|
+ ErrMessage = "用户条码号对应的物料不是:" + iSonCode;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ErrMessage = bar_prodcode;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ErrMessage = bar_prodcode;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else ErrMessage = "条码" + iSN + "不存在";
|
|
|
+ break;
|
|
|
+ case "RULE":
|
|
|
+ if (iIfRepeat != "-1")
|
|
|
+ {
|
|
|
+ if (iSubNum != "0")
|
|
|
+ {
|
|
|
+ int SubNum = int.Parse(iSubNum);
|
|
|
+ int SubNumLength = int.Parse(iSubNumLength);
|
|
|
+ if (iSN.Length > SubNum)
|
|
|
+ {
|
|
|
+ string tempstr = iSN.Substring(0, SubNum);
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select cm_barcode from craftmaterial where cm_barcode='" + iSN + "' and cm_status=0", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ ErrMessage = "条码" + iSN + "已经上料";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select cm_barcode from craftmaterial where cm_barcode='" + iSN + "' and cm_status=0", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ ErrMessage = "条码" + iSN + "已经上料";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ int sp_length = int.Parse(iLength != "" ? iLength : "0");
|
|
|
+ //若有多个,以|分割
|
|
|
+ string[] pres = iPrefix.Split('|');
|
|
|
+ bool f = false;
|
|
|
+ for (int i = 0; i < pres.Length; i++)
|
|
|
+ {
|
|
|
+ //表示需要按索引位置来区分
|
|
|
+ if (pres[i].IndexOf('#') > 0)
|
|
|
+ {
|
|
|
+ //索引位置
|
|
|
+ string index = pres[i].Split('#')[1];
|
|
|
+ string str = pres[i].Split('#')[0];
|
|
|
+ if (int.TryParse(index, out int index1))
|
|
|
+ {
|
|
|
+ if (iSN.Length > index1)
|
|
|
+ {
|
|
|
+ //先截取长度
|
|
|
+ if (pres[i] == "" ? true : iSN.Substring(index1 - 1).StartsWith(str))
|
|
|
+ {
|
|
|
+ //满足其中一条即可
|
|
|
+ f = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ErrMessage = "索引位置超出字符串长度";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ErrMessage = "索引位置填写不正确,必须是整数";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (pres[i] == "" ? true : iSN.StartsWith(pres[i]))
|
|
|
+ {
|
|
|
+ //满足其中一条即可
|
|
|
+ f = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (f)
|
|
|
+ {
|
|
|
+ //进行长度匹配
|
|
|
+ if (iSN.Length == sp_length || sp_length == 0)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else ErrMessage = iSN + "长度不匹配";
|
|
|
+ }
|
|
|
+ else ErrMessage = iSN + "前缀不匹配";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
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;
|