|
|
@@ -0,0 +1,534 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.ComponentModel;
|
|
|
+using System.Data;
|
|
|
+using System.Drawing;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Windows.Forms;
|
|
|
+using UAS_MES.DataOperate;
|
|
|
+using UAS_MES.Entity;
|
|
|
+using UAS_MES.PublicMethod;
|
|
|
+
|
|
|
+namespace UAS_MES.Warehouse
|
|
|
+{
|
|
|
+ public partial class Warehouse_ProductMakeInTest : Form
|
|
|
+ {
|
|
|
+
|
|
|
+ DataTable dbfind;
|
|
|
+
|
|
|
+ AutoSizeFormClass asc = new AutoSizeFormClass();
|
|
|
+
|
|
|
+ LogStringBuilder sql = new LogStringBuilder();
|
|
|
+
|
|
|
+ DataTable dt;
|
|
|
+
|
|
|
+ DataHelper dh;
|
|
|
+
|
|
|
+ DataTable dta;
|
|
|
+
|
|
|
+ DataTable dtpi;
|
|
|
+
|
|
|
+ DataTable dtform;
|
|
|
+
|
|
|
+ DataTable dtms;
|
|
|
+
|
|
|
+ int getcount;
|
|
|
+
|
|
|
+ public Warehouse_ProductMakeInTest()
|
|
|
+ {
|
|
|
+ InitializeComponent();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void input_KeyDown(object sender, KeyEventArgs e)
|
|
|
+ {
|
|
|
+ if (e.KeyCode == Keys.Enter)
|
|
|
+ {
|
|
|
+ if (input.Text == "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("录入信息不能为空\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!cancel.Checked)
|
|
|
+ {
|
|
|
+ if (palletBtn.Checked)
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pa_id,pa_outboxcode,pa_status,nvl(pa_downstatus,0)pa_downstatus,pa_makecode,");
|
|
|
+ sql.Append("pa_outno,nvl(pa_iostatus,0) pa_iostatus from package where pa_outboxcode='" + input.Text + "' and pa_type=3");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
|
|
|
+ string pa_iostatus = dt.Rows[0]["pa_iostatus"].ToString();
|
|
|
+ string pa_status = dt.Rows[0]["pa_status"].ToString();
|
|
|
+ string pa_outno = dt.Rows[0]["pa_outno"].ToString();
|
|
|
+ string pa_id = dt.Rows[0]["pa_id"].ToString();
|
|
|
+ string pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
|
|
|
+ if (!CheckStatus(pa_downstatus, pa_status, pa_iostatus, pa_outno, "栈板"))
|
|
|
+ return;
|
|
|
+ insertprodiomac(pa_id, pa_makecode, "PALLET");
|
|
|
+ OperateResult.AppendText("栈板" + input.Text + "完工入库成功\n", Color.Green);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("栈板号" + input.Text + "不存在,重新输入栈板号\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (bigboxBtn.Checked)
|
|
|
+ {
|
|
|
+ string outboxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_sncode = '" + input.Text + "'").ToString();
|
|
|
+ if (outboxcode != "")
|
|
|
+ {
|
|
|
+ input.Text = outboxcode;
|
|
|
+ }
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pa_id,pa_outboxcode,pa_status,nvl(pa_downstatus,0)pa_downstatus,pa_makecode,");
|
|
|
+ sql.Append("pa_outno,pa_mothercode,nvl(pa_iostatus,0) pa_iostatus from package where pa_outboxcode='" + input.Text + "' and pa_type in (1,2)");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string pa_mothercode = dt.Rows[0]["pa_mothercode"].ToString();
|
|
|
+ string pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
|
|
|
+ string pa_iostatus = dt.Rows[0]["pa_iostatus"].ToString();
|
|
|
+ string pa_status = dt.Rows[0]["pa_status"].ToString();
|
|
|
+ string pa_outno = dt.Rows[0]["pa_outno"].ToString();
|
|
|
+ string pa_id = dt.Rows[0]["pa_id"].ToString();
|
|
|
+ string pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
|
|
|
+ if (pa_mothercode != "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("箱号" + input.Text + "已经装大箱或者栈板" + pa_mothercode + ",不允许单独操作\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!CheckStatus(pa_downstatus, pa_status, pa_iostatus, pa_outno, "箱"))
|
|
|
+ return;
|
|
|
+ insertprodiomac(pa_id, pa_makecode, "BOX");
|
|
|
+ OperateResult.AppendText("箱号" + input.Text + "完工入库成功\n", Color.Green);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("箱号" + input.Text + "不存在,重新输入箱号\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (serBtn.Checked)
|
|
|
+ {
|
|
|
+ string ms_id = dh.getFieldDataByCondition("makeserial", "max(ms_id)ms_id", "ms_sncode='" + input.Text + "'").ToString();
|
|
|
+ if (ms_id == "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "不存在,请重新输入\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select ms_status,nvl(ms_downstatus,0)ms_downstatus,ms_outboxcode,ms_makecode,nvl(ms_iostatus,0)ms_iostatus,ms_prodcode,ms_outno from makeserial where ms_id='" + ms_id + "'");
|
|
|
+ dtms = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ string ms_downstatus = dtms.Rows[0]["ms_downstatus"].ToString();
|
|
|
+ string ms_status = dtms.Rows[0]["ms_status"].ToString();
|
|
|
+ string ms_outboxcode = dtms.Rows[0]["ms_outboxcode"].ToString();
|
|
|
+ string ms_iostatus = dtms.Rows[0]["ms_iostatus"].ToString();
|
|
|
+ string ms_outno = dtms.Rows[0]["ms_outno"].ToString();
|
|
|
+ string ms_prodcode = dtms.Rows[0]["ms_prodcode"].ToString();
|
|
|
+ string ms_makecode = dtms.Rows[0]["ms_makecode"].ToString();
|
|
|
+ if (ms_status != "2")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "未完工,不允许出货\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (ms_outboxcode != "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "有外箱号" + ms_outboxcode + ",不允许单独操作\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (ms_downstatus != "0")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "处于下地状态,不允许出货\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (ms_iostatus == "1")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "已经入库,不允许重复入库\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (ms_iostatus == "2")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "已经出库,出库单号:" + ms_outno + "\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (ms_iostatus == "3")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "处于售后退货状态\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("insert into prodiomac(pim_id,pim_prodcode,pim_mac,pim_indate,pim_inman,pim_type,pim_inorout,pim_class) ");
|
|
|
+ sql.Append("values(prodiomac_seq.nextval,'" + ms_prodcode + "','" + input.Text + "',sysdate,'" + User.UserCode + "',' ','IN','完工入库')");
|
|
|
+ dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_iostatus=1", " ms_id='" + ms_id + "'");
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "序列号" + input.Text + "完工入库", "序列号" + input.Text + "完工入库成功", input.Text, "");
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "完工入库成功\n", Color.Green);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("未选择录入数据类型\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ LoadGridData();
|
|
|
+ input.Clear();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (palletBtn.Checked)
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pa_id,pa_outboxcode,pa_status,nvl(pa_downstatus,0)pa_downstatus,pa_makecode,");
|
|
|
+ sql.Append("pa_outno,nvl(pa_iostatus,0) pa_iostatus from package where pa_outboxcode='" + input.Text + "' and pa_type=3");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
|
|
|
+ string pa_iostatus = dt.Rows[0]["pa_iostatus"].ToString();
|
|
|
+ string pa_status = dt.Rows[0]["pa_status"].ToString();
|
|
|
+ string pa_outno = dt.Rows[0]["pa_outno"].ToString();
|
|
|
+ string pa_id = dt.Rows[0]["pa_id"].ToString();
|
|
|
+ string pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
|
|
|
+ if (pa_iostatus != "1")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("栈板号" + input.Text + "不是在库状态,无需取消完工入库\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (pa_outno != "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("栈板号" + input.Text + "已被出货单单号:" + pa_outno + "锁定\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ DeleteData();
|
|
|
+ deleteprodiomac(pa_id, pa_makecode, "PALLET");
|
|
|
+ OperateResult.AppendText("栈板" + input.Text + "取消完工入库成功\n", Color.Green, input);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("栈板号" + input.Text + "不存在,重新输入栈板号\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (bigboxBtn.Checked)
|
|
|
+ {
|
|
|
+ string outboxcode = dh.getFieldDataByCondition("makeserial", "ms_outboxcode", "ms_sncode = '" + input.Text + "'").ToString();
|
|
|
+ if (outboxcode != "")
|
|
|
+ {
|
|
|
+ input.Text = outboxcode;
|
|
|
+ }
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pa_id,pa_outboxcode,pa_status,nvl(pa_downstatus,0)pa_downstatus,pa_makecode,");
|
|
|
+ sql.Append("pa_outno,pa_mothercode,nvl(pa_iostatus,0) pa_iostatus from package where pa_outboxcode='" + input.Text + "' and pa_type in (1,2)");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string pa_mothercode = dt.Rows[0]["pa_mothercode"].ToString();
|
|
|
+ string pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
|
|
|
+ string pa_iostatus = dt.Rows[0]["pa_iostatus"].ToString();
|
|
|
+ string pa_status = dt.Rows[0]["pa_status"].ToString();
|
|
|
+ string pa_outno = dt.Rows[0]["pa_outno"].ToString();
|
|
|
+ string pa_id = dt.Rows[0]["pa_id"].ToString();
|
|
|
+ string pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
|
|
|
+ if (pa_mothercode != "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("箱号" + input.Text + "已经装大箱或者栈板" + pa_mothercode + ",不允许单独操作\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (pa_iostatus != "1")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("箱号" + input.Text + "不是在库状态,无需取消完工入库\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (pa_outno != "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("箱号" + input.Text + "已被出货单单号:" + pa_outno + "锁定\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ DeleteData();
|
|
|
+ deleteprodiomac(pa_id, pa_makecode, "BOX");
|
|
|
+ OperateResult.AppendText("箱号" + input.Text + "取消完工入库成功\n", Color.Green, input);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("箱号" + input.Text + "不存在,重新输入箱号\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (serBtn.Checked)
|
|
|
+ {
|
|
|
+ string ms_id = dh.getFieldDataByCondition("makeserial", "max(ms_id)ms_id", "ms_sncode='" + input.Text + "'").ToString();
|
|
|
+ if (ms_id == "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "不存在,请重新输入\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select ms_status,nvl(ms_downstatus,0)ms_downstatus,ms_outboxcode,ms_makecode,nvl(ms_iostatus,0)ms_iostatus,ms_prodcode,ms_outno from makeserial where ms_id='" + ms_id + "'");
|
|
|
+ dtms = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ string ms_downstatus = dtms.Rows[0]["ms_downstatus"].ToString();
|
|
|
+ string ms_status = dtms.Rows[0]["ms_status"].ToString();
|
|
|
+ string ms_outboxcode = dtms.Rows[0]["ms_outboxcode"].ToString();
|
|
|
+ string ms_iostatus = dtms.Rows[0]["ms_iostatus"].ToString();
|
|
|
+ string ms_outno = dtms.Rows[0]["ms_outno"].ToString();
|
|
|
+ string ms_prodcode = dtms.Rows[0]["ms_prodcode"].ToString();
|
|
|
+ string ms_makecode = dtms.Rows[0]["ms_makecode"].ToString();
|
|
|
+ if (ms_outboxcode != "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "有外箱号" + ms_outboxcode + ",不允许单独操作\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (ms_outno != "")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "已被出货单单号:" + ms_outno + "锁定\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (ms_iostatus != "1")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "不是在库状态,无需取消完工入库\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ DeleteData();
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("delete from prodiomac where pim_id =(select max(pim_id) from prodiomac where ");
|
|
|
+ sql.Append(" pim_mac='" + input.Text + "' and pim_inorout='IN' AND pim_class='完工入库' )");
|
|
|
+ dh.ExecuteSql(sql.GetString(), "delete");
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_iostatus=0", " ms_id='" + ms_id + "'");
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "序列号" + input.Text + "取消完工入库", "序列号" + input.Text + "取消完工入库成功", input.Text, "");
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "取消完工入库成功\n", Color.Green, input);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("未选择录入数据类型\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ getqty.Text = ((DataTable)bindingSource1.DataSource).Rows.Count.ToString();
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Boolean CheckStatus(string pa_downstatus, string pa_status, string pa_iostatus, string pa_outno, string type)
|
|
|
+ {
|
|
|
+ if (pa_status == "0")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(type + "号" + input.Text + "未封装\n", Color.Red, input);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (pa_downstatus != "0")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(type + "号" + input.Text + "处于下地状态,如需完工入库,请先取消下地\n", Color.Red, input);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (pa_iostatus == "1")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(type + "号" + input.Text + "已经入库,不允许重复入库\n", Color.Red, input);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (pa_iostatus == "2")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(type + "号" + input.Text + "已经出库,出库单号:" + pa_outno + "\n", Color.Red, input);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (pa_iostatus == "3")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(type + "号" + input.Text + "处于售后退货状态\n", Color.Red, input);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select wm_concat(v_barcode)data,count(1)cn from mes_package_view left join ");
|
|
|
+ sql.Append("makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode ");
|
|
|
+ sql.Append("where v_outboxcode='" + input.Text + "' and nvl(ms_status,0)<>2 and rownum<20");
|
|
|
+ dta = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ string CN = dta.Rows[0]["CN"].ToString();
|
|
|
+ string DATA = dta.Rows[0]["DATA"].ToString();
|
|
|
+ if (int.Parse(CN) > 0)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(type + "号" + input.Text + "内的序列号尚未完工,不允许进行完工入库,序列号:" + DATA + "\n", Color.Red, input);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void insertprodiomac(string pa_id, string pa_makecode, string type)
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("insert into prodiomac(pim_id,pim_prodcode,pim_mac,pim_indate,pim_inman,pim_type,pim_outboxcode,pim_inorout,pim_class) ");
|
|
|
+ sql.Append("select prodiomac_seq.nextval,v_prodcode,v_barcode,sysdate,'" + User.UserCode + "','" + type + "','" + input.Text + "','IN','完工入库' from mes_package_view where v_outboxcode='" + input.Text + "'");
|
|
|
+ dh.ExecuteSql(sql.GetString(), "update");
|
|
|
+ dh.UpdateByCondition("package", "pa_iostatus=1", "pa_id='" + pa_id + "'");
|
|
|
+ if (type == "BOX")
|
|
|
+ {
|
|
|
+ type = "箱";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ type = "栈板";
|
|
|
+ //dh.UpdateByCondition("makeserial", "ms_iostatus=1", "ms_id in (select max(ms_id) from makeserial where ms_sncode in (select v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '"+input.Text+"') GROUP BY ms_sncode)");
|
|
|
+ List<string> v_barcode = new List<string>();
|
|
|
+ List<string> v_makecode = new List<string>();
|
|
|
+ DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "'", "select");
|
|
|
+ for (int i = 0; i < datatable.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ v_barcode.Add(datatable.Rows[i]["v_barcode"].ToString());
|
|
|
+ v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
|
|
|
+ }
|
|
|
+ dh.BatchInsert("update makeserial set ms_iostatus=1 where ms_sncode = :v_barcode and ms_makecode = :v_makecode", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, type + "号" + input.Text + "完工入库", type + "号" + input.Text + "完工入库成功", "", input.Text);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 加载Grid数据
|
|
|
+ /// </summary>
|
|
|
+ private void LoadGridData()
|
|
|
+ {
|
|
|
+ if (palletBtn.Checked || bigboxBtn.Checked)
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
|
|
|
+ sql.Append("left join product on pr_code=pim_prodcode where pim_outboxcode='" + input.Text + "'and pim_inorout='IN' AND pim_class='完工入库'");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ (bindingSource1.DataSource as DataTable).Merge(dt.Copy());
|
|
|
+ BaseUtil.FillDgvWithDataTable(InOutDetailDGV, (DataTable)bindingSource1.DataSource);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
|
|
|
+ sql.Append("left join product on pr_code=pim_prodcode where pim_mac='" + input.Text + "' and pim_inorout='IN' AND pim_class='完工入库'");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ (bindingSource1.DataSource as DataTable).Merge(dt.Copy());
|
|
|
+ BaseUtil.FillDgvWithDataTable(InOutDetailDGV, (DataTable)bindingSource1.DataSource);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 去除重复Grid数据
|
|
|
+ /// </summary>
|
|
|
+ private void DeleteData()
|
|
|
+ {
|
|
|
+ if (palletBtn.Checked || bigboxBtn.Checked)
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
|
|
|
+ sql.Append("left join product on pr_code=pim_prodcode where pim_outboxcode='" + input.Text + "' and pim_inorout='IN' AND pim_class='完工入库'");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ BaseUtil.FillDgvWithDataTable(InOutDetailDGV, BaseUtil.DataTableMerge((DataTable)bindingSource1.DataSource, dt, "pim_id"));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
|
|
|
+ sql.Append("left join product on pr_code=pim_prodcode where pim_mac='" + input.Text + "' and pim_inorout='IN' AND pim_class='完工入库'");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ BaseUtil.FillDgvWithDataTable(InOutDetailDGV, BaseUtil.DataTableMerge((DataTable)bindingSource1.DataSource, dt, "pim_id"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void deleteprodiomac(string pa_id, string pa_makecode, string type)
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("delete from prodiomac where pim_id in (select pim_id from prodiomac where ");
|
|
|
+ sql.Append(" pim_outboxcode='" + input.Text + "' and pim_type='" + type + "' and pim_inorout='IN' AND pim_class='完工入库' )");
|
|
|
+ dh.ExecuteSql(sql.GetString(), "delete");
|
|
|
+ dh.UpdateByCondition("package", "pa_iostatus=0", "pa_id='" + pa_id + "'");
|
|
|
+ List<string> v_barcode = new List<string>();
|
|
|
+ List<string> v_makecode = new List<string>();
|
|
|
+ DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "'", "select");
|
|
|
+ for (int i = 0; i < datatable.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ v_barcode.Add(datatable.Rows[i]["v_barcode"].ToString());
|
|
|
+ v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
|
|
|
+ }
|
|
|
+ dh.BatchInsert("update makeserial set ms_iostatus=0 where ms_sncode = :v_barcode and ms_makecode = :v_makecode", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, type + "号" + input.Text + "取消完工入库", type + "号" + input.Text + "取消完工入库成功", "", input.Text);
|
|
|
+ //dh.UpdateByCondition("makeserial", "ms_iostatus=0", "ms_id in (select max(ms_id) from makeserial where ms_sncode in (select v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "') GROUP BY ms_sncode)");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Warehouse_ProductMakeIn_Load(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ asc.controllInitializeSize(this);
|
|
|
+ getcount = 0;
|
|
|
+ getqty.Text = getcount.ToString();
|
|
|
+ dh = SystemInf.dh;
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
|
|
|
+ sql.Append("left join product on pr_code=pim_prodcode where pim_id is null");
|
|
|
+ bindingSource1.DataSource = dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ input.Focus();
|
|
|
+ OperateResult.AppendText("请输入栈板进行采集\n", Color.Black, input);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Warehouse_ProductMakeIn_SizeChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ asc.controlAutoSize(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void serBtn_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ if (((RadioButton)sender).Checked == true)
|
|
|
+ {
|
|
|
+ if (((RadioButton)sender).Name == "serBtn")
|
|
|
+ {
|
|
|
+ input.Focus();
|
|
|
+ OperateResult.AppendText("请输入序列号进行采集\n", Color.Black, input);
|
|
|
+ }
|
|
|
+ else if (((RadioButton)sender).Name == "bigboxBtn")
|
|
|
+ {
|
|
|
+ input.Focus();
|
|
|
+ OperateResult.AppendText("请输入箱号进行采集\n", Color.Black, input);
|
|
|
+ }
|
|
|
+ else if (((RadioButton)sender).Name == "palletBtn")
|
|
|
+ {
|
|
|
+ input.Focus();
|
|
|
+ OperateResult.AppendText("请输入栈板进行采集\n", Color.Black, input);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void textBoxWithPlaceHolder1_UserControlTextChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ if (pallecode.Text.Length == 0)
|
|
|
+ {
|
|
|
+ input.Enabled = true;
|
|
|
+ if (bindingSource1.DataSource != null)
|
|
|
+ {
|
|
|
+ BaseUtil.FillDgvWithDataTable(InOutDetailDGV, (DataTable)bindingSource1.DataSource);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Search_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ if (pallecode.Text.Length >= 1)
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
|
|
|
+ sql.Append("left join product on pr_code=pim_prodcode where pim_outboxcode like '%" + pallecode.Text + "%' and pim_inorout='IN' AND pim_class='完工入库'");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ BaseUtil.FillDgvWithDataTable(InOutDetailDGV, dt);
|
|
|
+ input.Enabled = false;
|
|
|
+ }else
|
|
|
+ OperateResult.AppendText("查询栏为空\n", Color.Black);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void InOutDetailDGV_DataSourceChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ getqty.Text = InOutDetailDGV.Rows.Count.ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|