|
|
@@ -76,6 +76,64 @@ namespace UAS_MES_NEW.PublicMethod
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static bool CheckMaterial(string iSN, out string Error)
|
|
|
+ {
|
|
|
+ Error = "";
|
|
|
+ LogStringBuilder sql = new LogStringBuilder();
|
|
|
+
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select ms_bomversion,ms_craftcode,ms_firstsn,ms_prodcode,ms_makecode from makeserial where ms_sncode='" + iSN + "' and ms_wccode like '%组装%' order by ms_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string ms_bomversion = dt.Rows[0]["ms_bomversion"].ToString();
|
|
|
+ string ms_craftcode = dt.Rows[0]["ms_craftcode"].ToString();
|
|
|
+ string ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
|
|
|
+ string ms_firstsn = dt.Rows[0]["ms_firstsn"].ToString();
|
|
|
+ string ms_makecode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select wm_concat(sp_soncode) sp_soncode from stepproduct left join product on pr_code=sp_fsoncode where ");
|
|
|
+ sql.Append("sp_bomversion='" + ms_bomversion + "' and sp_craftcode='" + ms_craftcode + "' ");
|
|
|
+ sql.Append("And sp_mothercode ='" + ms_prodcode + "' and sp_tracekind=1 and not exists(select 1 from craftmaterial where ");
|
|
|
+ sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ms_makecode + "' and cm_fsoncode=");
|
|
|
+ sql.Append("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode)");
|
|
|
+ DataTable dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt1.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ if (dt1.Rows[0]["sp_soncode"].ToString() != "")
|
|
|
+ {
|
|
|
+ Error += "组装工单号" + dt1.Rows[0]["sp_soncode"] + "的物料信息有误";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select ms_bomversion,ms_craftcode,ms_firstsn,ms_prodcode,ms_makecode from makeserial where ms_sncode='" + iSN + "' and ms_wccode like '%包装%' order by ms_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string ms_bomversion = dt.Rows[0]["ms_bomversion"].ToString();
|
|
|
+ string ms_craftcode = dt.Rows[0]["ms_craftcode"].ToString();
|
|
|
+ string ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
|
|
|
+ string ms_firstsn = dt.Rows[0]["ms_firstsn"].ToString();
|
|
|
+ string ms_makecode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select wm_concat(sp_soncode) sp_soncode from stepproduct left join product on pr_code=sp_fsoncode where ");
|
|
|
+ sql.Append("sp_bomversion='" + ms_bomversion + "' and sp_craftcode='" + ms_craftcode + "' ");
|
|
|
+ sql.Append("And sp_mothercode ='" + ms_prodcode + "' and sp_tracekind=1 and not exists(select 1 from craftmaterial where ");
|
|
|
+ sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ms_makecode + "' and cm_fsoncode=");
|
|
|
+ sql.Append("sp_fsoncode and cm_status=0 and cm_stepcode=sp_stepcode) ");
|
|
|
+ DataTable dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt1.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ if (dt1.Rows[0]["sp_soncode"].ToString() != "") {
|
|
|
+ Error += "包装工单号" + dt1.Rows[0]["sp_soncode"] + "的物料信息有误";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Error != "")
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+
|
|
|
+ }
|
|
|
public static void GetSerialNumByCaller(string iCaller, out string SerialNum)
|
|
|
{
|
|
|
SerialNum = "";
|
|
|
@@ -1248,7 +1306,7 @@ namespace UAS_MES_NEW.PublicMethod
|
|
|
if ((tempstr.Length >= SubNumLength))
|
|
|
{
|
|
|
tempstr = iSN.Substring(SubNum, SubNumLength);
|
|
|
- dt = (DataTable)dh.ExecuteSql("select cm_barcode from craftmaterial where (CM_SUBSTR='" + tempstr + "' or cm_barcode='"+iSN+"') and cm_status=0", "select");
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select cm_barcode from craftmaterial where (CM_SUBSTR='" + tempstr + "' or cm_barcode='" + iSN + "') and cm_status=0", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
ErrMessage = "条码" + tempstr + "已经上料";
|