123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479 |
- 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.Packing
- {
- public partial class Packing_CartonTransfer : Form
- {
- AutoSizeFormClass asc = new AutoSizeFormClass();
- DataTable dt;
- DataTable dt1;
- DataTable dtbar;
- DataTable dtst;
- LogStringBuilder sql = new LogStringBuilder();
- DataHelper dh;
- //目标箱号相关变量
- string new_pa_downstatus;
- string new_pa_currentqty;
- string new_pa_standardqty;
- string new_pa_packtype;
- string new_pa_prodcode;
- string new_pa_salecode;
- string new_pa_checkno;
- string new_ob_status;
- string new_pa_mothercode;
- public Packing_CartonTransfer()
- {
- InitializeComponent();
- }
- private void Packing_CartonTransfer_Load(object sender, EventArgs e)
- {
- asc.controllInitializeSize(this);
- dh = SystemInf.dh;
- movepack.Focus();
- OperateResult.AppendText(">>请输入目标箱号\n", Color.Black);
- }
- private void Packing_CartonTransfer_SizeChanged(object sender, EventArgs e)
- {
- asc.controlAutoSize(this);
- }
- private void movepack_Click(object sender, EventArgs e)
- {
- if (((RadioButton)sender).Checked == true)
- {
- if (((RadioButton)sender).Name == "movepack")
- {
- pa_outboxcode.Text = "";
- pa_currentqty.Text = "";
- pa_standardqty.Text = "";
- pa_standardqty.Enabled = false;
- ALLMOVE.Enabled = false;
- pa_outboxcode.Focus();
- }
- else if (((RadioButton)sender).Name == "newpack")
- {
- pa_outboxcode.Text = "";
- pa_currentqty.Text = "";
- pa_standardqty.Text = "";
- pa_standardqty.Enabled = true;
- ALLMOVE.Enabled = true;
- pa_outboxcode.Focus();
- }
- }
- }
- private void pa_outboxcode_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- if (newpack.Checked)
- {
- if (dh.CheckExist("package", "pa_outboxcode = '" + pa_outboxcode.Text + "'"))
- {
- OperateResult.AppendText(">>该箱号" + pa_outboxcode.Text + "已经存在,如需转移至已经存在的箱号,请选择移箱\n", Color.Red, pa_outboxcode);
- pa_outboxcode.Focus();
- return;
- }
- }
- else if (movepack.Checked)
- {
- CheckBoxCode();
- }
- }
- }
- private void sn_code_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- string ms_id = dh.getFieldDataByCondition("makeserial", "max(ms_id) ms_id", "ms_sncode = '" + sn_code.Text + "'").ToString();
- if (ms_id != "")
- {
- OperateResult.AppendText(">>序列号:" + sn_code.Text + "\n", Color.Black);
- sql.Clear();
- sql.Append("select ms_id,ms_prodcode,ms_outboxcode,ms_makecode ms_msmakecode, ms_sccode,");
- sql.Append("nvl(ms_currentstepcode,ms_stepcode ) laststepcode, ms_sccode lastsccode,");
- sql.Append("ms_checkno from makeserial where ms_id='" + ms_id + "'");
- dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- string ms_outboxcode = dt1.Rows[0]["ms_outboxcode"].ToString();
- string msprodcode = dt1.Rows[0]["ms_prodcode"].ToString();
- string ms_makecode = dt1.Rows[0]["ms_msmakecode"].ToString();
- if (ms_outboxcode != "")
- {
- sql.Clear();
- sql.Append("select pa_id,pa_checkno,PA_MAKECODE,PA_CURRENTQTY pa_qty,PA_PACKTYPE,nvl(PA_DOWNSTATUS,0) PA_DOWNSTATUS,pa_prodcode pa_macode,pa_salecode,pa_level,pa_custcode,pa_type,pa_packtype,pa_mothercode,pa_weight,pa_nextstep,pa_status,pa_sccode from package where pa_outboxcode='" + ms_outboxcode + "'");
- dtbar = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- if (dtbar.Rows.Count > 0)
- {
- string pa_mothercode = dtbar.Rows[0]["pa_mothercode"].ToString();
- string PA_PACKTYPE = dtbar.Rows[0]["PA_PACKTYPE"].ToString();
- string pa_checkno = dtbar.Rows[0]["pa_checkno"].ToString();
- string PA_DOWNSTATUS = dtbar.Rows[0]["PA_DOWNSTATUS"].ToString();
- string old_pa_id = dtbar.Rows[0]["pa_id"].ToString();
- string ob_status = dh.getFieldDataByCondition("oqcbatch", "ob_status", "ob_checkno = '" + pa_checkno + "'").ToString();
- if (pa_mothercode != "")
- {
- OperateResult.AppendText(">>原箱" + ms_outboxcode + "已装入大箱或栈板"+ pa_mothercode + ",不允许转移\n", Color.Red, sn_code);
- return;
- }
- if (PA_DOWNSTATUS == "0")
- {
- BaseUtil.SetFormValue(this.Controls, dtbar);
- BaseUtil.SetFormValue(this.Controls, dt1);
- if (PA_PACKTYPE == "MIX")
- {
- ms_prodcode.Text = "混包";
- }
- else if (PA_PACKTYPE == "SALE")
- {
- ms_msmakecode.Text = pa_salecode.Text;
- }
- if (newpack.Checked)
- {
- if (ob_status != "UNCHECK" || ob_status != "CHECKING")
- {
- if (pa_standardqty.Text != "")
- {
- if (pa_outboxcode.Text != "")
- {
- if (dh.CheckExist("package", "pa_outboxcode = '" + pa_outboxcode.Text + "'"))
- {
- OperateResult.AppendText(">>该箱号" + pa_outboxcode.Text + "已经存在,如需转移至已经存在的箱号,请选择移箱\n", Color.Red, pa_outboxcode);
- pa_outboxcode.Focus();
- return;
- }
- else
- {
- string pa_id = dh.GetSEQ("package_seq");
- //新增箱
- sql.Clear();
- sql.Append("insert into package (PA_ID, PA_OUTBOXCODE,PA_PRODCODE, PA_PACKDATE,");
- sql.Append("PA_LEVEL,PA_PACKAGEQTY,PA_TOTALQTY,PA_MAKECODE,PA_STATUS,PA_INDATE,");
- sql.Append("PA_SALECODE,PA_CUSTCODE,PA_TYPE,PA_CURRENTQTY,PA_PACKTYPE,PA_STANDARDQTY,pa_nextstep,pa_sccode,pa_checkno)");
- sql.Append("values ('" + pa_id + "','" + pa_outboxcode.Text + "','" + msprodcode + "',sysdate,'" + pa_level.Text + "','0','0'");
- sql.Append(",'" + ms_makecode + "','0',sysdate,'" + pa_salecode.Text + "','" + pa_custcode.Text + "','" + pa_type.Text + "','0','" + pa_packtype.Text + "','" + pa_standardqty.Text + "','"+pa_nextstep.Text+"','"+pa_sccode.Text+"','"+pa_checkno+"')");
- dh.ExecuteSql(sql.GetString(), "insert");
- //删除原明细
- dh.ExecuteSql("delete from packagedetail where pd_paid='" + old_pa_id + "' and pd_barcode = '" + sn_code.Text + "'", "delete");
- sql.Clear();
- sql.Append("insert into packagedetail (PD_ID,PD_PAID,PD_OUTBOXCODE,PD_BARCODE,PD_INNERQTY,PD_PRODCODE,PD_MAKECODE,PD_BUILDDATE,PD_YMD)");
- sql.Append("values (packagedetail_seq.nextval,'" + pa_id + "','" + pa_outboxcode.Text + "','" + sn_code.Text + "','1','" + msprodcode + "','" + ms_makecode + "',sysdate,to_char(sysdate,'yyyymmdd'))");
- dh.ExecuteSql(sql.GetString(), "insert");
- //更新原箱数量
- dh.UpdateByCondition("package", "pa_currentqty=pa_currentqty-1,pa_status=0", "pa_outboxcode = '" + ms_outboxcode + "'");
- //更新目标箱数量
- dh.UpdateByCondition("package", "pa_currentqty=1, pa_totalqty=1,pa_packageqty=1", "pa_outboxcode = '" + pa_outboxcode.Text + "'");
- dh.UpdateByCondition("makeserial", "ms_outboxcode = '" + pa_outboxcode.Text + "'", "ms_id = '" + ms_id + "'");
- dh.UpdateByCondition("oqcbatchdetail", "obd_outboxcode = '" + pa_outboxcode.Text + "'", "obd_sncode = '" + sn_code.Text + "'");
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "卡通箱转移", "卡通箱转移,生成目标箱号" + pa_outboxcode.Text + "", sn_code.Text, "");
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "卡通箱转移", "序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "", sn_code.Text, "");
- OperateResult.AppendText(">>序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "\n", Color.Green);
- pa_outboxcode_KeyDown(sender, e);
- }
- }
- else
- {
- OperateResult.AppendText(">>必须填写新增目标箱号\n", Color.Red);
- return;
- }
- }
- else
- {
- OperateResult.AppendText(">>新增目标箱号必须填写标准容量\n", Color.Red);
- return;
- }
- }
- else
- {
- OperateResult.AppendText(">>原箱" + ms_outboxcode + "处于送检状态,不允许转移\n", Color.Red, sn_code);
- return;
- }
- }
- else if (movepack.Checked)
- {
- if (CheckBoxCode())
- {
- if (pa_outboxcode.Text == ms_outboxcode)
- {
- OperateResult.AppendText(">>原箱" + ms_outboxcode + "和目标箱号" + pa_outboxcode.Text + "相同,不允许转移\n", Color.Red, sn_code);
- return;
- }
- if (PA_PACKTYPE != new_pa_packtype)
- {
- OperateResult.AppendText(">>原箱" + ms_outboxcode + "和目标箱号" + pa_outboxcode.Text + "的包装方式不一致,不允许转移\n", Color.Red, sn_code);
- return;
- }
- if (PA_PACKTYPE != "MIX")
- {
- if (ms_prodcode.Text != new_pa_prodcode)
- {
- OperateResult.AppendText(">>原箱号和目标箱号(目标箱产品编号" + new_pa_prodcode + ")的产品编号不一致,不允许转移\n", Color.Red, sn_code);
- return;
- }
- if (PA_PACKTYPE == "SALE")
- {
- if (pa_salecode.Text != new_pa_salecode)
- {
- OperateResult.AppendText(">>原箱号和目标箱号的合同号不一致,不允许转移\n", Color.Red, sn_code);
- return;
- }
- }
- }
- if (pa_checkno != new_pa_checkno)
- {
- if ((pa_checkno == "" && new_pa_checkno != "") || (pa_checkno != "" && new_pa_checkno == ""))
- {
- if (pa_checkno != "" && (ob_status == "UNCHECK" || ob_status == "CHECKING"))
- {
- OperateResult.AppendText(">>原箱号处于送检状态,不允许转移\n", Color.Red, sn_code);
- return;
- }
- if (new_pa_checkno != "" && (new_ob_status == "UNCHECK" || new_ob_status == "CHECKING"))
- {
- OperateResult.AppendText(">>目标箱号处于送检状态,不允许转移\n", Color.Red, sn_code);
- return;
- }
- }
- if (pa_checkno != "" && new_pa_checkno != "")
- {
- string a_ob_result = dh.getFieldDataByCondition("oqcbatch", "ob_status", "ob_checkno = '" + pa_checkno + "'").ToString();
- string b_ob_result = dh.getFieldDataByCondition("oqcbatch", "ob_status", "ob_checkno = '" + new_pa_checkno + "'").ToString();
- if (!((a_ob_result == b_ob_result) && (b_ob_result == "OK" || b_ob_result == "NG")))
- {
- OperateResult.AppendText(">>原箱号和目标箱号必须抽检完成,并且结果一致才可以转移\n", Color.Red, sn_code);
- return;
- }
- }
- }
- string new_laststepcode = dh.getFieldDataByCondition("packagedetail inner join makeserial on ms_outboxcode=pd_outboxcode and ms_sncode=pd_barcode and ms_prodcode = pd_prodcode", "max(nvl(ms_currentstepcode,ms_stepcode))", "pd_outboxcode='" + pa_outboxcode.Text + "'").ToString();
- if (new_laststepcode!=""&&(new_laststepcode != laststepcode.Text))
- {
- OperateResult.AppendText(">>目标箱号中的序列号最后所在工序与所录入序列号最后所在工序不一致\n", Color.Red, sn_code);
- return;
- }
- //删除原明细
- dh.ExecuteSql("delete from packagedetail where pd_paid='" + old_pa_id + "' and pd_barcode = '" + sn_code.Text + "'", "delete");
- //更新操作
- sql.Clear();
- sql.Append("insert into packagedetail (PD_ID,PD_PAID,PD_OUTBOXCODE,PD_BARCODE,PD_INNERQTY,PD_PRODCODE,PD_MAKECODE,PD_BUILDDATE,PD_YMD)");
- sql.Append("values (packagedetail_seq.nextval,'" + dh.getFieldDataByCondition("package", "pa_id", "PA_OUTBOXCODE = '" + pa_outboxcode.Text + "'").ToString() + "','" + pa_outboxcode.Text + "','" + sn_code.Text + "','1','" + msprodcode + "','" + ms_makecode + "',sysdate,to_char(sysdate,'yyyymmdd'))");
- dh.ExecuteSql(sql.GetString(), "insert");
- //更新原箱数量
- dh.UpdateByCondition("package", "pa_currentqty=pa_currentqty-1,pa_status=0", "pa_outboxcode = '" + ms_outboxcode + "'");
- //更新目标箱数量
- dh.UpdateByCondition("package", "pa_currentqty=nvl(pa_currentqty,0)+ 1,pa_totalqty=nvl(pa_totalqty,0)+1,pa_packageqty=nvl(pa_packageqty ,0)+1", "pa_outboxcode = '" + pa_outboxcode.Text + "'");
- dh.UpdateByCondition("makeserial", "ms_outboxcode = '" + pa_outboxcode.Text + "'", "ms_id = '" + ms_id + "'");
- dh.UpdateByCondition("oqcbatchdetail", "obd_outboxcode = '" + pa_outboxcode.Text + "'","obd_sncode = '" + sn_code.Text + "'");
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "卡通箱转移", "序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "", sn_code.Text, "");
- OperateResult.AppendText(">>序列号:" + sn_code.Text + ",从原箱号:" + ms_outboxcode + "转移至目标箱号:" + pa_outboxcode.Text + "\n", Color.Green);
- // pa_outboxcode_KeyDown(sender, e);
- sql.Clear();
- sql.Append("select pa_id,pa_checkno,PA_CURRENTQTY pa_qty,PA_PACKTYPE,nvl(PA_DOWNSTATUS,0) PA_DOWNSTATUS,pa_prodcode pa_macode,pa_salecode,pa_level,pa_custcode,pa_type,pa_packtype,pa_mothercode from package where pa_outboxcode='" + ms_outboxcode + "'");
- dtbar = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- BaseUtil.SetFormValue(this.Controls, dtbar);
- }
- }
- }
- else OperateResult.AppendText(">>原箱" + ms_outboxcode + "已经下地\n", Color.Red, sn_code);
- }
- else OperateResult.AppendText(">>序列号" + sn_code.Text + "未装箱\n", Color.Red, sn_code);
- }
- else OperateResult.AppendText(">>序列号" + sn_code.Text + "未装箱\n", Color.Red, sn_code);
- }
- else OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在\n", Color.Red, sn_code);
- }
- }
- private Boolean CheckBoxCode()
- {
- sql.Clear();
- sql.Append("select pa_id,pa_outboxcode,pa_checkno,pa_standardqty,nvl(pa_currentqty,0) pa_currentqty,pa_packtype,pa_prodcode,nvl(pa_downstatus,0) pa_downstatus,pa_salecode,pa_mothercode from package where pa_outboxcode='" + pa_outboxcode.Text + "'");
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- if (dt.Rows.Count > 0)
- {
- new_pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
- new_pa_currentqty = dt.Rows[0]["pa_currentqty"].ToString();
- new_pa_standardqty = dt.Rows[0]["pa_standardqty"].ToString();
- new_pa_packtype = dt.Rows[0]["pa_packtype"].ToString();
- new_pa_prodcode = dt.Rows[0]["pa_prodcode"].ToString();
- new_pa_salecode = dt.Rows[0]["pa_salecode"].ToString();
- new_pa_checkno = dt.Rows[0]["pa_checkno"].ToString();
- new_pa_mothercode = dt.Rows[0]["pa_mothercode"].ToString();
- new_ob_status = dh.getFieldDataByCondition("oqcbatch", "ob_status", "ob_checkno = '" + new_pa_checkno + "'").ToString();
- if (new_pa_downstatus != "0")
- {
- OperateResult.AppendText(">>该目标箱号" + pa_outboxcode.Text + "处于下地状态,不允许操作\n", Color.Red, pa_outboxcode);
- BaseUtil.CleanControls(groupBoxWithBorder2.Controls);
- OperateResult.AppendText(">>请输入目标箱号\n", Color.Black);
- pa_outboxcode.Focus();
- return false;
- }
- else if (new_pa_currentqty == new_pa_standardqty)
- {
- OperateResult.AppendText(">>目标箱号" + pa_outboxcode.Text + "已装满\n", Color.Red, pa_outboxcode);
- BaseUtil.CleanControls(groupBoxWithBorder2.Controls);
- OperateResult.AppendText(">>请输入目标箱号\n", Color.Black);
- pa_outboxcode.Focus();
- return false;
- }
- else if (new_pa_mothercode != "")
- {
- OperateResult.AppendText(">>目标箱号" + pa_outboxcode.Text + "装入大箱\n", Color.Red, pa_outboxcode);
- BaseUtil.CleanControls(groupBoxWithBorder2.Controls);
- OperateResult.AppendText(">>请输入目标箱号\n", Color.Black);
- pa_outboxcode.Focus();
- return false;
- }
- BaseUtil.SetFormValue(this.Controls, dt);
- return true;
- }
- else
- {
- OperateResult.AppendText(">>该目标箱号" + pa_outboxcode.Text + "不存在\n", Color.Red, pa_outboxcode);
- OperateResult.AppendText(">>请输入目标箱号\n", Color.Black);
- pa_outboxcode.Focus();
- return false;
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- BaseUtil.CleanControls(this.Controls);
- }
- private void ms_outboxcode_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- sql.Clear();
- sql.Append("select pa_id,pa_checkno,PA_MAKECODE,PA_CURRENTQTY pa_qty,PA_PACKTYPE,nvl(PA_DOWNSTATUS,0) PA_DOWNSTATUS,pa_prodcode pa_macode,pa_salecode,pa_level,pa_custcode,pa_type,pa_packtype,pa_mothercode,pa_weight,pa_nextstep,pa_status,pa_sccode from package where pa_outboxcode='" + ms_outboxcode.Text + "'");
- DataTable dtbar = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- if (dtbar.Rows.Count > 0)
- {
- BaseUtil.SetFormValue(this.Controls, dtbar);
- }
- else OperateResult.AppendText(">>箱号" + ms_outboxcode.Text + "不存在\n", Color.Red, ms_outboxcode);
- }
- }
- private void ALLMOVE_Click(object sender, EventArgs e)
- {
- sql.Clear();
- sql.Append("select pa_id,pa_checkno,PA_MAKECODE,PA_CURRENTQTY pa_qty,PA_PACKTYPE,nvl(PA_DOWNSTATUS,0) PA_DOWNSTATUS,pa_prodcode pa_macode,pa_salecode,pa_level,pa_custcode,pa_type,pa_packtype,pa_mothercode,pa_weight,pa_nextstep,pa_status,pa_sccode from package where pa_outboxcode='" + ms_outboxcode.Text + "'");
- dtbar = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- if (dtbar.Rows.Count > 0)
- {
- BaseUtil.SetFormValue(this.Controls, dtbar);
- }
- else
- {
- OperateResult.AppendText(">>箱号" + ms_outboxcode.Text + "不存在\n", Color.Red, ms_outboxcode);
- return;
- }
- string pa_mothercode = dtbar.Rows[0]["pa_mothercode"].ToString();
- string PA_PACKTYPE = dtbar.Rows[0]["PA_PACKTYPE"].ToString();
- string pa_checkno = dtbar.Rows[0]["pa_checkno"].ToString();
- string PA_DOWNSTATUS = dtbar.Rows[0]["PA_DOWNSTATUS"].ToString();
- string old_pa_id = dtbar.Rows[0]["pa_id"].ToString();
- string pa_makecode = dtbar.Rows[0]["pa_makecode"].ToString();
- string pa_macode = dtbar.Rows[0]["pa_macode"].ToString();
- string ob_status = dh.getFieldDataByCondition("oqcbatch", "ob_status", "ob_checkno = '" + pa_checkno + "'").ToString();
- if (pa_mothercode != "")
- {
- OperateResult.AppendText(">>原箱" + ms_outboxcode.Text + "已装入大箱,不允许转移\n", Color.Red, sn_code);
- return;
- }
- if (ob_status != "UNCHECK" || ob_status != "CHECKING")
- {
- if (pa_standardqty.Text != "")
- {
- if (int.Parse(pa_standardqty.Text) < int.Parse(pa_qty.Text))
- {
- OperateResult.AppendText(">>填写的标准容量" + pa_standardqty.Text + "小于待转移箱的容量\n", Color.Red);
- return;
- }
- if (pa_outboxcode.Text != "")
- {
- if (dh.CheckExist("package", "pa_outboxcode = '" + pa_outboxcode.Text + "'"))
- {
- OperateResult.AppendText(">>该箱号" + pa_outboxcode.Text + "已经存在,如需转移至已经存在的箱号,请选择移箱\n", Color.Red, pa_outboxcode);
- pa_outboxcode.Focus();
- return;
- }
- else
- {
- string pa_id = dh.GetSEQ("package_seq");
- //新增箱
- sql.Clear();
- sql.Append("insert into package (PA_ID, PA_OUTBOXCODE,PA_PRODCODE, PA_PACKDATE,");
- sql.Append("PA_LEVEL,PA_PACKAGEQTY,PA_TOTALQTY,PA_MAKECODE,PA_STATUS,PA_INDATE,");
- sql.Append("PA_SALECODE,PA_CUSTCODE,PA_TYPE,PA_CURRENTQTY,PA_PACKTYPE,PA_STANDARDQTY,pa_weight,pa_nextstep,pa_sccode,pa_checkno)");
- sql.Append("values ('" + pa_id + "','" + pa_outboxcode.Text + "','" + pa_macode + "',sysdate,'" + pa_level.Text + "','0','0'");
- sql.Append(",'" + pa_makecode + "','"+ pa_status.Text + "',sysdate,'" + pa_salecode.Text + "','" + pa_custcode.Text + "','" + pa_type.Text + "','0','" + pa_packtype.Text + "','" + pa_standardqty.Text + "','"+pa_weight.Text+"','"+ pa_nextstep.Text + "','"+ pa_sccode.Text + "','"+pa_checkno+"')");
- dh.ExecuteSql(sql.GetString(), "insert");
- ////删除原明细
- //dh.ExecuteSql("delete from packagedetail where pd_paid='" + old_pa_id + "'", "delete");
- //sql.Clear();
- //sql.Append("insert into packagedetail (PD_ID,PD_PAID,PD_OUTBOXCODE,PD_BARCODE,PD_INNERQTY,PD_PRODCODE,PD_MAKECODE,PD_BUILDDATE,PD_YMD)");
- //sql.Append("values (packagedetail_seq.nextval,'" + pa_id + "','" + pa_outboxcode.Text + "','" + sn_code.Text + "','1','" + pa_macode + "','" + pa_makecode + "',sysdate,to_char(sysdate,'yyyymmdd'))");
- //dh.ExecuteSql(sql.GetString(), "insert");
- dh.UpdateByCondition("packagedetail", "PD_OUTBOXCODE = '" + pa_outboxcode.Text + "',PD_PAID = '" + pa_id + "'", "pd_paid='" + old_pa_id + "'");
- //更新原箱数量
- dh.UpdateByCondition("package", "pa_currentqty=0,pa_status=0,pa_weight = '',pa_checkno = ''", "pa_outboxcode = '" + ms_outboxcode.Text + "'");
- //更新目标箱数量
- dh.UpdateByCondition("package", "pa_currentqty=" + int.Parse(pa_qty.Text) + ", pa_totalqty=" + int.Parse(pa_qty.Text) + ",pa_packageqty=" + int.Parse(pa_qty.Text) + "", "pa_outboxcode = '" + pa_outboxcode.Text + "'");
- dh.UpdateByCondition("makeserial", "ms_outboxcode = '" + pa_outboxcode.Text + "'", "ms_outboxcode = '" + ms_outboxcode.Text + "'");
- dh.UpdateByCondition("oqcbatchdetail", "obd_outboxcode = '" + pa_outboxcode.Text + "'", "obd_outboxcode = '" + ms_outboxcode.Text + "'");
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "卡通箱转移", "卡通箱转移,生成目标箱号" + pa_outboxcode.Text + "", "", "");
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "卡通箱转移", "原箱号:" + ms_outboxcode.Text + "全部转移至目标箱号:" + pa_outboxcode.Text + "", "", "");
- OperateResult.AppendText("原箱号:" + ms_outboxcode.Text + "全部转移至目标箱号:" + pa_outboxcode.Text + "\n", Color.Green);
- }
- }
- else
- {
- OperateResult.AppendText(">>必须填写新增目标箱号\n", Color.Red);
- return;
- }
- }
- else
- {
- OperateResult.AppendText(">>新增目标箱号必须填写标准容量\n", Color.Red);
- return;
- }
- }
- else
- {
- OperateResult.AppendText(">>原箱" + ms_outboxcode.Text + "处于送检状态,不允许转移\n", Color.Red, sn_code);
- return;
- }
- }
- }
- }
|