| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- using System;
- using System.Data;
- using System.Drawing;
- using System.Windows.Forms;
- using UAS_MES_NEW.DataOperate;
- using UAS_MES_NEW.Entity;
- using UAS_MES_NEW.PublicMethod;
- namespace UAS_MES_NEW.Make
- {
- public partial class Make_Aging : Form
- {
- DataHelper dh;
- AutoSizeFormClass asc = new AutoSizeFormClass();
- LogStringBuilder sql = new LogStringBuilder();
- DataTable dt;
- //当前序列号记录
- string sn_code;
- //制造单号
- string macode;
- //采集网标号
- float net_code;
- //网标查询条件ms_id
- string oMsID;
- //打印计数
- int printcount = 0;
- int ma_unlimitin;
- string ErrorMessage = "";
- string LastSncode;
- public Make_Aging()
- {
- InitializeComponent();
- }
- private void Make_CollectNetCode_Load(object sender, EventArgs e)
- {
- asc.controllInitializeSize(this);
- sncode.Focus();
- dh = SystemInf.dh;
- }
- private void sncode_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- //采集序列号
- if (sncode.Text == "")
- {
- OperateResult.AppendText(">>箱号不能为空\n", Color.Red);
- return;
- }
- DataTable dt = (DataTable)dh.ExecuteSql("select ms_makecode,ms_prodcode,pr_detail from makeserial " +
- "left join product on pr_code=ms_prodcode where ms_outboxcode='" + sncode.Text + "' ", "select");
- if (dt.Rows.Count > 0)
- {
- BaseUtil.SetFormValue(this.Controls, dt);
- }
- dt = (DataTable)dh.ExecuteSql("select pa_makecode,pa_nextstep from package where pa_outboxcode='" + sncode.Text + "' and nvl(pa_status,0)=0 ", "select");
- if (dt.Rows.Count > 0)
- {
- string pa_nextstep = dt.Rows[0]["pa_nextstep"].ToString();
- if (pa_nextstep != User.CurrentStepCode)
- {
- OperateResult.AppendText(">>箱号" + sncode.Text + "当前工序不对应\n", Color.Red);
- return;
- }
- string pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
- {
- dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty", "pa_outboxcode='" + sncode.Text + "'");
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "老化上架", "箱号" + sncode.Text + "上架成功", sncode.Text, "");
- string ms_makecode = dh.getFieldDataByCondition("packagedetail", "pd_makecode", "pd_outboxcode = '" + sncode.Text + "'").ToString();
- if (LogicHandler.OutBoxStepPass(sncode.Text, ms_makecode, User.UserSourceCode, User.UserCode, "卡通箱:" + sncode.Text + "整箱过站", "卡通箱整箱过站", out ErrorMessage))
- {
- dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + sncode.Text + "'").ToString() + "', PA_CURRENTSTEP = '' ", "pa_outboxcode='" + sncode.Text + "'");
- OperateResult.AppendText(">>箱号" + sncode.Text + "上架成功\n", Color.Green);
- }
- else
- {
- OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
- }
- //写入老化明细表
- dh.ExecuteSql("insert into AGEINGDETAIL(AGD_ID, AGD_AGCODE, AGD_MAKECODE, AGD_SNCODE, AGD_INDATE)" +
- "select AGEINGDETAIL_seq.nextval,'" + sncode.Text + "',pd_makecode,pd_barcode,sysdate from packagedetail " +
- "where pd_outboxcode='" + sncode.Text + "'", "insert");
- dh.ExecuteSql("insert into PACKAGEBACKUPDETAIL select * from PACKAGEDETAIL where pd_outboxcode='" + sncode.Text + "' and pd_barcode not in (select pbd_barcode from PACKAGEBACKUPDETAIL)", "insert");
- dh.ExecuteSql("delete from PACKAGEDETAIL where pd_outboxcode='" + sncode.Text + "'", "delete");
- dh.ExecuteSql("insert into PACKAGEBACKUP select * from PACKAGE where pa_outboxcode='" + sncode.Text + "' and pa_outboxcode not in (select pa_outboxcode from PACKAGEBACKUP)", "insert");
- dh.ExecuteSql("delete from PACKAGE where pa_outboxcode='" + sncode.Text + "'", "delete");
- dh.ExecuteSql("update makeserial set ms_outboxcode='' where ms_outboxcode='" + sncode.Text + "'", "update");
- //显示老化数据
- dt = (DataTable)dh.ExecuteSql("select AGD_AGCODE,AGD_MAKECODE,AGD_SNCODE,to_char(AGD_INDATE,'yyyy-mm-dd hh24:mi:ss')AGD_INDATE " +
- "from AGEINGDETAIL where AGD_AGCODE='" + sncode.Text + "'", "select");
- BaseUtil.FillDgvWithDataTable(LabelDataGridView, dt);
- }
- }
- else OperateResult.AppendText(">>箱号" + sncode.Text + "已经上架\n", Color.Red);
- }
- }
- private void Make_CollectNetCode_SizeChanged(object sender, EventArgs e)
- {
- asc.controlAutoSize(this);
- }
- private void Make_CollectNetCode_Activated(object sender, EventArgs e)
- {
- sncode.Focus();
- }
- void fildgv()
- {
- }
- private void snCollectionBox1_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- fildgv();
- sncode.Focus();
- sncode.SelectAll();
- }
- }
- }
- }
|