|
|
@@ -54,8 +54,6 @@ namespace UAS_MES.Make
|
|
|
|
|
|
List<string> CollectDataSonCode = new List<string>();
|
|
|
|
|
|
- List<string> SPBOMVERSION = new List<string>();
|
|
|
-
|
|
|
List<string> SPID = new List<string>();
|
|
|
|
|
|
public Make_FeedingCollection()
|
|
|
@@ -145,8 +143,7 @@ namespace UAS_MES.Make
|
|
|
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();
|
|
|
- string spbomversion = dt1.Rows[RemainIndex]["sp_bomversion"].ToString();
|
|
|
- string spid = dt1.Rows[RemainIndex]["sp_id"].ToString();
|
|
|
+ string sp_id = dt1.Rows[RemainIndex]["sp_id"].ToString();
|
|
|
string sp_ifforsn = dt1.Rows[RemainIndex]["sp_ifforsn"].ToString();
|
|
|
string sp_barcoderule = dt1.Rows[RemainIndex]["sp_barcoderule"].ToString();
|
|
|
if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
|
|
|
@@ -162,7 +159,7 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
sp_soncode = ErrorMessage;
|
|
|
}
|
|
|
- Save_OtherCode(sp_soncode, make_code, sn_code.Text, spid, spbomversion);
|
|
|
+ Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
|
|
|
}
|
|
|
else
|
|
|
OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
|
|
|
@@ -229,7 +226,7 @@ namespace UAS_MES.Make
|
|
|
//将录入框的值给序列号
|
|
|
sn_code.Text = code.Text;
|
|
|
sql.Clear();
|
|
|
- sql.Append("select ma_prodcode,ma_ecncode,ma_craftcode,ma_softversion,ms_firstsn,ma_bomversion,ma_qty,ma_code,pr_detail,ms_status,ms_id,ms_craftcode,ms_nextstepcode");
|
|
|
+ sql.Append("select ma_prodcode,ma_ecncode,ma_softversion,ms_firstsn,ma_bomversion,ma_qty,ma_code,pr_detail,ms_status,ms_id,ms_craftcode,ms_nextstepcode");
|
|
|
sql.Append(",ms_prodcode,ms_makecode,ms_code,ms_stepname from makeserial left join make on ma_code=ms_makecode ");
|
|
|
sql.Append("left join product on ms_prodcode=pr_code where ms_sncode='" + code.Text + "' order by ms_id desc");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
@@ -268,20 +265,18 @@ namespace UAS_MES.Make
|
|
|
if (dt.Rows[0]["ms_makecode"].ToString() != ma_code.Text && dt.Rows[0]["ms_status"].ToString() == "2")
|
|
|
{
|
|
|
sql.Clear();
|
|
|
- sql.Append("select sp_id,sp_bomversion,sp_soncode from make inner join stepbom on ma_prodcode=sb_prodcode and ma_bomversion=sb_bomversion left ");
|
|
|
+ sql.Append("select sp_id,sp_soncode from make inner join stepbom on ma_prodcode=sb_prodcode and ma_bomversion=sb_bomversion left ");
|
|
|
sql.Append("join stepproduct on sp_sbid=sb_id where ma_code='" + ma_code.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' ");
|
|
|
sql.Append("and sp_stepcode='" + User.CurrentStepCode + "' and nvl(sp_ifforsn,0)<>0");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- string spbomversion = dt.Rows[0]["sp_bomversion"].ToString();
|
|
|
- string spid = dt.Rows[0]["sp_id"].ToString();
|
|
|
+ string sp_id = dt.Rows[0]["sp_id"].ToString();
|
|
|
string sp_soncode = dt.Rows[0]["sp_soncode"].ToString();
|
|
|
if (!dh.CheckExist("Craftmaterial", "cm_makecode='" + ma_code.Text + "' and cm_soncode='" + make_prodcode + "' and cm_sncode='" + code.Text + "' and cm_status=0"))
|
|
|
{
|
|
|
- SPID.Add(spid);
|
|
|
CollectDataSonCode.Add(sp_soncode);
|
|
|
- SPBOMVERSION.Add(spbomversion);
|
|
|
+ SPID.Add(sp_id);
|
|
|
CollectData.Add(code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
|
|
|
sn_code.Text = code.Text;
|
|
|
OperateResult.AppendText(">>序列号" + code.Text + ",物料" + sp_soncode + "上料成功\n", Color.Green);
|
|
|
@@ -307,7 +302,7 @@ namespace UAS_MES.Make
|
|
|
ms_status = dt.Rows[0]["ms_status"].ToString();
|
|
|
sn_code.Text = code.Text;
|
|
|
sql.Clear();
|
|
|
- sql.Append("select ma_code,ma_softversion,ma_craftcode,ma_ecncode,ma_prodcode,pr_detail,ma_qty,ma_craftcode from makeserial left join product ");
|
|
|
+ sql.Append("select ma_code,ma_softversion,ma_ecncode,ma_prodcode,pr_detail,ma_qty from makeserial left join product ");
|
|
|
sql.Append(" on ms_prodcode=pr_code left join make on ms_makecode=ma_code left join ");
|
|
|
sql.Append("makecraftdetail on mcd_macode=ms_makecode where ms_id='" + oMsid + "'");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
@@ -331,11 +326,11 @@ namespace UAS_MES.Make
|
|
|
//单独用一个DataTable存储一个
|
|
|
dt1 = new DataTable();
|
|
|
sql.Clear();
|
|
|
- sql.Append("select max(sp_id)sp_id,max(sp_bomversion)sp_bomversion,max(sp_detno)sp_detno,sp_fsoncode,max(sp_barcoderule)");
|
|
|
+ sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,sp_fsoncode,max(sp_barcoderule)");
|
|
|
sql.Append("sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
|
|
|
sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,max(sp_prefix)sp_prefix,max(sp_regex)");
|
|
|
sql.Append("sp_regex,max(pr_detail)pr_detail from stepproduct left join product on pr_code=sp_fsoncode where ");
|
|
|
- sql.Append("sp_bomversion='" + ma_bomversion.Text + "' and sp_craftcode='" + ma_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
|
|
|
+ sql.Append("sp_bomversion='" + ma_bomversion.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
|
|
|
sql.Append("And sp_mothercode ='" + ma_prodcode.Text + "' 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='" + ma_code.Text + "' and cm_fsoncode=");
|
|
|
sql.Append("sp_fsoncode and cm_status=0) group by sp_fsoncode order by SP_DETNO asc");
|
|
|
@@ -382,14 +377,13 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
|
|
|
//此类中通用的保存逻辑
|
|
|
- private void Save_OtherCode(string sp_soncode, string ma_code, string ms_sncode,string spid, string spbomversion)
|
|
|
+ private void Save_OtherCode(string sp_soncode, string ma_code, string ms_sncode, string sp_id)
|
|
|
{
|
|
|
CollectDataSonCode.Add(sp_soncode);
|
|
|
//采集成功提示
|
|
|
RemainIndex = RemainIndex + 1;
|
|
|
CollectData.Add(code.Text.Substring(0, code.Text.Length > 40 ? 40 : code.Text.Length));
|
|
|
- SPID.Add(spid);
|
|
|
- SPBOMVERSION.Add(spbomversion);
|
|
|
+ SPID.Add(sp_id);
|
|
|
OperateResult.AppendText(">>物料" + sp_soncode + "采集成功,条码" + code.Text + "\n", Color.Green);
|
|
|
code.Clear();
|
|
|
//如果+1后不小于B序列的长度,则已采集完成,不需要进行提示了
|
|
|
@@ -406,14 +400,14 @@ namespace UAS_MES.Make
|
|
|
sql.Append("mcd_stepname,sp_fsoncode,ms_craftcode,ms_craftname,:barcode,1,sysdate,'" + User.UserCode + "','" + User.UserLineCode + "',ma_wccode,");
|
|
|
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='" + make_code + "'and sp_bomversion=:sp_bomversion and mcd_stepcode = '" + User.CurrentStepCode + "' and ms_sncode='" + ms_sncode + "'");
|
|
|
- dh.BatchInsert(sql.GetString(), new string[] { "soncode", "barcode", "sp_id", "sp_bomversion" }, CollectDataSonCode.ToArray(), CollectData.ToArray(), SPID.ToArray(), SPBOMVERSION.ToArray());
|
|
|
+ sql.Append("where ma_code='" + make_code + "'and sp_id=:sp_id1 and mcd_stepcode = '" + User.CurrentStepCode + "' and ms_sncode='" + ms_sncode + "'");
|
|
|
+ dh.BatchInsert(sql.GetString(), new string[] { "soncode", "barcode", "sp_id", "sp_id1" }, CollectDataSonCode.ToArray(), CollectData.ToArray(), SPID.ToArray(), SPID.ToArray());
|
|
|
try
|
|
|
{
|
|
|
string Log = "";
|
|
|
for (int i = 0; i < CollectDataSonCode.Count; i++)
|
|
|
{
|
|
|
- Log += CollectDataSonCode.ToArray()[i] + " " + CollectData.ToArray()[i] + " " + SPBOMVERSION.ToArray()[i];
|
|
|
+ Log += CollectDataSonCode.ToArray()[i] + " " + CollectData.ToArray()[i] + " " + SPID.ToArray()[i];
|
|
|
}
|
|
|
LogManager.DoLog(Log);
|
|
|
}
|
|
|
@@ -437,9 +431,8 @@ namespace UAS_MES.Make
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
}
|
|
|
CollectData.Clear();
|
|
|
- SPID.Clear();
|
|
|
TSN.Clear();
|
|
|
- SPBOMVERSION.Clear();
|
|
|
+ SPID.Clear();
|
|
|
CollectDataSonCode.Clear();
|
|
|
//采集成功,设置序列号栏目为空
|
|
|
RemainIndex = 0;
|
|
|
@@ -463,10 +456,9 @@ namespace UAS_MES.Make
|
|
|
private void ClearSn_code_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
sn_code.Clear();
|
|
|
- SPBOMVERSION.Clear();
|
|
|
+ SPID.Clear();
|
|
|
TSN.Clear();
|
|
|
CollectData.Clear();
|
|
|
- SPID.Clear();
|
|
|
CollectDataSonCode.Clear();
|
|
|
if (dt1 != null)
|
|
|
BaseUtil.CleanDataTableData(dt1);
|