|
|
@@ -108,8 +108,8 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
//判断是否是途程第一道工序
|
|
|
sql.Clear();
|
|
|
- sql.Append("select cd_id from craft left join craftdetail on cd_crid=cr_id where cr_craftcode='" + ma_craftcode.Text + "' ");
|
|
|
- sql.Append("and cr_prodcode='" + pr_code.Text + "' and nvl(cd_iffirst,0)<>0 and cd_stepcode='" + User.CurrentStepCode + "'");
|
|
|
+ sql.Append("select cd_id from craft left join craftdetail on cd_crid=cr_id where cr_code='" + ma_craftcode.Text + "' ");
|
|
|
+ sql.Append("and cr_prodcode='" + pr_code.Text + "' and nvl(cd_firststep,0)<>0 and cd_stepcode='" + User.CurrentStepCode + "'");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
@@ -121,13 +121,14 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
//序列号信息
|
|
|
sql.Clear();
|
|
|
- sql.Append("select ms_beforesn,ms_firstsn,ms_outboxcode,ms_nextmacode,ms_prodcode,ms_salecode,");
|
|
|
- sql.Append("MS_IMEI1,MS_MAC,MS_NETCODE,MS_MEID,ms_imei2,ms_imei13,ms_othid1,ms_othid2,ms_othid3");
|
|
|
+ sql.Append("select ms_beforesn,ms_makecode,ms_firstsn,ms_outboxcode,ms_nextmacode,ms_prodcode,ms_salecode,");
|
|
|
+ sql.Append("MS_IMEI1,MS_MAC,MS_NETCODE,MS_MEID,ms_imei2,ms_imei3,ms_othid1,ms_othid2,ms_othid3");
|
|
|
sql.Append(",MS_OTHCODE3,MS_OTHCODE2,MS_OTHCODE1,ms_bt from makeserial where ms_id='" + Msid + "'");
|
|
|
DataTable SnInf = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- string ms_prodcode = SnInf.Rows[0]["ma_prodcode"].ToString();
|
|
|
- string ms_salecode = SnInf.Rows[0]["ma_salecode"].ToString();
|
|
|
+ string ms_prodcode = SnInf.Rows[0]["ms_prodcode"].ToString();
|
|
|
+ string ms_salecode = SnInf.Rows[0]["ms_salecode"].ToString();
|
|
|
string ms_beforesn = SnInf.Rows[0]["ms_beforesn"].ToString();
|
|
|
+ string ms_makecode = SnInf.Rows[0]["ms_makecode"].ToString();
|
|
|
//判断是否已装箱
|
|
|
if (SnInf.Rows[0]["ms_outboxcode"].ToString() != "")
|
|
|
{
|
|
|
@@ -142,14 +143,14 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
//工单信息
|
|
|
sql.Clear();
|
|
|
- sql.Append("select ma_salecode,ma_prodcode,ma_inqty,ma_craftcode,ma_qty,nvl(ma_inqty,0) ma_inqty,");
|
|
|
+ sql.Append("select ma_salecode,ma_prodcode,ma_craftname,ma_inqty,ma_craftcode,ma_qty,nvl(ma_inqty,0) ma_inqty,");
|
|
|
sql.Append("nvl(ma_scrapqty,0)ma_scrapqty,ma_id,nvl(ma_unlimitin,0) ma_unlimitin,ma_wccode from make ");
|
|
|
sql.Append("where ma_code='" + ma_code.Text + "'and ma_kind='返工' and ma_statuscode='STARTED'");
|
|
|
DataTable MaInf = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
string ma_prodcode = MaInf.Rows[0]["ma_prodcode"].ToString();
|
|
|
string ma_salecode = MaInf.Rows[0]["ma_salecode"].ToString();
|
|
|
int ma_unlimitin = int.Parse(MaInf.Rows[0]["ma_unlimitin"].ToString());
|
|
|
- int ma_iqnty = int.Parse(MaInf.Rows[0]["ma_iqnty"].ToString());
|
|
|
+ int ma_inqty = int.Parse(MaInf.Rows[0]["ma_inqty"].ToString());
|
|
|
int ma_scrapqty = int.Parse(MaInf.Rows[0]["ma_scrapqty"].ToString());
|
|
|
int ma_qty = int.Parse(MaInf.Rows[0]["ma_qty"].ToString());
|
|
|
if (ma_prodcode != ms_prodcode)
|
|
|
@@ -162,27 +163,15 @@ namespace UAS_MES.Make
|
|
|
OperateResult.AppendText(">>序列号所属合同" + ms_salecode + "与返工工单合同不一致\n", Color.Red, sn_code);
|
|
|
return;
|
|
|
}
|
|
|
- if (ma_unlimitin == 0 && ma_iqnty - ma_scrapqty + 1 > ma_qty)
|
|
|
+ if (ma_unlimitin == 0 && ma_inqty - ma_scrapqty + 1 > ma_qty)
|
|
|
{
|
|
|
OperateResult.AppendText(">>工单不允许超数投产\n", Color.Red, sn_code);
|
|
|
return;
|
|
|
}
|
|
|
- string SN = "";
|
|
|
- if (ReWorkAsCurrentSN.Checked)
|
|
|
+ if (ReWorkAsRelateTSN.Checked && ms_beforesn == "")
|
|
|
{
|
|
|
- SN = sn_code.Text;
|
|
|
- }
|
|
|
- else if (ReWorkAsRelateTSN.Checked)
|
|
|
- {
|
|
|
- if (ms_beforesn != "")
|
|
|
- {
|
|
|
- SN = sn_code.Text;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText(">>TSN不存在\n", Color.Red, sn_code);
|
|
|
- return;
|
|
|
- }
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在TSN\n", Color.Red, sn_code);
|
|
|
+ return;
|
|
|
}
|
|
|
string netcode = "";
|
|
|
string imeid = "";
|
|
|
@@ -228,25 +217,33 @@ namespace UAS_MES.Make
|
|
|
if (salecode == "")
|
|
|
{
|
|
|
salecode = SnInf.Rows[0]["ms_salecode"].ToString();
|
|
|
- dh.ExecuteSql("update make set ma_salecode='" + salecode + "' where ma_id='" + ma_id + "'", "update");
|
|
|
+ dh.ExecuteSql("update make set ma_salecode='" + salecode + "' where ma_id='" + ma_id.Text + "'", "update");
|
|
|
}
|
|
|
sql.Clear();
|
|
|
sql.Append("insert into MakeSerial(ms_id,ms_code,ms_sncode,ms_prodcode,ms_indate,ms_wccode");
|
|
|
sql.Append(",ms_craftcode,ms_craftname,ms_nextstepcode,ms_status,ms_makecode,ms_linecode");
|
|
|
sql.Append(",ms_sourcecode,ms_maid,ms_firstsn,ms_salecode,ms_mac,ms_bt,ms_othcode1,ms_othcode2,");
|
|
|
- sql.Append("ms_othcode3,ms_netcode,ms_imei1,ms_imei2,ms_imei13,ms_meid,ms_othid1,ms_othid2,ms_othid3 ");
|
|
|
- sql.Append("values(MakeSerial_seq.nextval,'" + SN + "','" + SN + "','" + pr_code.Text + "',");
|
|
|
+ sql.Append("ms_othcode3,ms_netcode,ms_imei1,ms_imei2,ms_imei3,ms_meid,ms_othid1,ms_othid2,ms_othid3)");
|
|
|
+ sql.Append("values(MakeSerial_seq.nextval,'" + sn_code.Text + "','" + sn_code.Text + "','" + pr_code.Text + "',");
|
|
|
sql.Append("sysdate,'" + workcenter + "','" + craftcode + "','" + craftname + "','" + User.CurrentStepCode + "',");
|
|
|
sql.Append("1,'" + ma_code.Text + "','" + User.UserLineCode + "','" + User.UserSourceCode + "','" + ma_id.Text + "',");
|
|
|
sql.Append("'" + firstsn + "','" + salecode + "','" + mac + "','" + bt + "','" + othcode1 + "','" + othcode2 + "','" + othcode3 + "',");
|
|
|
sql.Append("'" + netcode + "','" + imei1 + "','" + imei2 + "','" + imei3 + "','" + imeid + "','" + othid1 + "','" + othid2 + "','" + othid3 + "')");
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
- dh.ExecuteSql("update make set ma_inqty=nvl(ma_inqty,0)+1 where ma_id='" + ma_id + "'", "update");
|
|
|
+ dh.ExecuteSql("update make set ma_inqty=nvl(ma_inqty,0)+1 where ma_id='" + ma_id.Text + "'", "update");
|
|
|
dh.ExecuteSql("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_id='" + Msid + "'", "update");
|
|
|
if (ReWorkAsRelateTSN.Checked)
|
|
|
{
|
|
|
-
|
|
|
+ dh.ExecuteSql("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_sncode='" + ms_beforesn + "' and ms_nextmacode='" + ms_makecode + "'", "update");
|
|
|
+ }
|
|
|
+ OperateResult.AppendText(">>序列号" + sn_code.Text + "归属工单" + ma_code.Text + "成功。\n", Color.Green);
|
|
|
+ if (AutoPrint.Checked)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>打印序列号" + sn_code.Text + "\n", Color.Black);
|
|
|
+ Print.CodeSoft(lbl, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), PrinterList.Text, sn_code.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_printcount=nvl(ms_printcount,0)+1", "ms_sncode='" + sn_code.Text + "'");
|
|
|
}
|
|
|
+ sn_code.Clear();
|
|
|
}
|
|
|
else OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在\n", Color.Red, sn_code);
|
|
|
}
|
|
|
@@ -278,10 +275,6 @@ namespace UAS_MES.Make
|
|
|
ma_savemacbt.Checked = true;
|
|
|
}
|
|
|
}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // OperateResult.AppendText(">>不存在返工工单" + ma_code.Text + "\n", Color.Red);
|
|
|
- //}
|
|
|
}
|
|
|
}
|
|
|
}
|