|
|
@@ -45,7 +45,7 @@ namespace UAS_MES.Warehouse
|
|
|
pi_inoutno.TableName = "prodinout";
|
|
|
pi_inoutno.DBTitle = "出货单查询";
|
|
|
pi_inoutno.SelectField = "pi_id # ID,pi_title # 客户名称,pi_inoutno # 出货单号,pi_type # 出货类型";
|
|
|
- pi_inoutno.SetValueField = new string[] { "pi_title", "pi_inoutno", "pi_id" };
|
|
|
+ pi_inoutno.SetValueField = new string[] { "pi_title", "pi_inoutno", "pi_id", "pi_type" };
|
|
|
pi_inoutno.FormName = Name;
|
|
|
pi_inoutno.Condition = "pi_pdastatus<>'已出库' and pi_class='出货单'";
|
|
|
pi_inoutno.DbChange += Pi_inoutno_DbChange;
|
|
|
@@ -71,7 +71,7 @@ namespace UAS_MES.Warehouse
|
|
|
sql.Clear();
|
|
|
sql.Append("select pi_id,pi_title,pi_inoutno,pi_type from prodinout where pi_inoutno = '" + pi_inoutno.Text + "'");
|
|
|
dtpi = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ if (dtpi.Rows.Count > 0)
|
|
|
{
|
|
|
BaseUtil.SetFormValue(this.Controls, dtpi);
|
|
|
}
|
|
|
@@ -85,6 +85,13 @@ namespace UAS_MES.Warehouse
|
|
|
BaseUtil.SetFormValue(this.Controls, dtform);
|
|
|
ungetqty.Text = (int.Parse(dtform.Rows[0]["outqty"].ToString()) - int.Parse(dtform.Rows[0]["getqty"].ToString())).ToString();
|
|
|
}
|
|
|
+ if (pi_type.Text == "按订单出货")
|
|
|
+ {
|
|
|
+ pi_type_check.Checked = true;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ pi_type_check.Checked = false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -122,14 +129,53 @@ namespace UAS_MES.Warehouse
|
|
|
|
|
|
private void ProdDetail_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- Warehouse_ProdDetail newpd = new Warehouse_ProdDetail();
|
|
|
+ Warehouse_ProdDetail newpd = new Warehouse_ProdDetail(pi_inoutno.Text,pi_id.Text);
|
|
|
BaseUtil.SetFormCenter(newpd);
|
|
|
newpd.ShowDialog();
|
|
|
}
|
|
|
|
|
|
private void ConfirmOut_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+ String dialog = MessageBox.Show("是否确认出货", "提示", MessageBoxButtons.OKCancel).ToString();
|
|
|
+ if (dialog != "OK")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("取消确认出货\n", Color.Black);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select nvl(pi_pdastatus,'未备货')pi_pdastatus,pi_id,pi_type from prodinout where pi_inoutno='" + pi_inoutno.Text + "'");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ if (dt.Rows[0]["pi_pdastatus"].ToString() == "已出库")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("出货单" + pi_inoutno.Text + "已经出库,无需重复确认\n", Color.Red);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if (dt.Rows[0]["pi_pdastatus"].ToString() == "未备货")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("出货单" + pi_inoutno.Text + "尚未备货,无法确认出货\n", Color.Red);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if (dt.Rows[0]["pi_type"].ToString() == "按订单出货" && dt.Rows[0]["pi_pdastatus"].ToString() == "备货中")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("出货单" + pi_inoutno.Text + "未完成备货,无法确认出货\n", Color.Red);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ dh.ExecuteSql("update package set pa_status=2 where exists (select 1 from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode=pa_outboxcode and ((pim_type='PALLET' AND PA_TYPE=3) OR (PIM_TYPE='BOX' AND PA_TYPE IN(1,2)))) AND PA_OUTNO='" + pi_inoutno.Text + "'", "update");
|
|
|
+ dh.ExecuteSql("update prodinout set pi_pdastatus='已出库' where pi_inoutno='" + pi_inoutno.Text + "'", "update");
|
|
|
+ dh.ExecuteSql("insert into messagelog(ml_id,ml_date,ml_man,ml_content,ml_result,ml_search)values(messagelog_seq.nextval,sysdate,'" + User.UserName + "','确认出货','确认出货成功','ProdInOut!Sale|pi_id=" + pi_id.Text + "')", "insert");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("出货单" + pi_inoutno.Text + "不存在\n", Color.Red, pi_inoutno);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void input_KeyDown(object sender, KeyEventArgs e)
|
|
|
@@ -168,7 +214,7 @@ namespace UAS_MES.Warehouse
|
|
|
else if (bigboxBtn.Checked)
|
|
|
{
|
|
|
sql.Clear();
|
|
|
- sql.Append("select pa_outboxcode,pa_status,nvl(pa_downstatus,0)pa_downstatus,pa_outno, pa_mothercode from package where pa_outboxcode='" + input.Text + "' and pa_type=(1,2)");
|
|
|
+ sql.Append("select pa_outboxcode,pa_status,nvl(pa_downstatus,0)pa_downstatus,pa_outno, pa_mothercode 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)
|
|
|
{
|
|
|
@@ -217,12 +263,12 @@ namespace UAS_MES.Warehouse
|
|
|
OperateResult.AppendText("序列号" + input.Text + "处于下地状态,不允许出货\n", Color.Red, input);
|
|
|
return;
|
|
|
}
|
|
|
- if (dtms.Rows[0]["ms_iostatus"].ToString() != "1")
|
|
|
+ if (dtms.Rows[0]["ms_iostatus"].ToString() != "0")
|
|
|
{
|
|
|
OperateResult.AppendText("序列号" + input.Text + "已经被出货单:" + dh.getFieldDataByCondition("makeserial left JOIN prodiomac on pim_mac=ms_sncode", "pim_inoutno", "ms_id='" + ms_id + "' order by pim_indate desc").ToString() + "出货\n", Color.Red, input);
|
|
|
return;
|
|
|
}
|
|
|
- if (dta.Rows[0]["pi_type"].ToString() == "订单出库")
|
|
|
+ if (dta.Rows[0]["pi_type"].ToString() == "按订单出货")
|
|
|
{
|
|
|
sql.Clear();
|
|
|
sql.Append("select cn,outqty,outqty-nvl((select count(1) from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_prodcode='" + dtms.Rows[0]["ms_prodcode"].ToString() + "'),0)ungetqty from");
|
|
|
@@ -246,25 +292,31 @@ namespace UAS_MES.Warehouse
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- LoadFormData();
|
|
|
- LoadGridData();
|
|
|
- if (dta.Rows[0]["pi_type"].ToString() == "订单出库")
|
|
|
+ else {
|
|
|
+ OperateResult.AppendText("未选择录入数据类型\n", Color.Red,input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (dta.Rows[0]["pi_type"].ToString() == "按订单出货")
|
|
|
{
|
|
|
if (int.Parse(dtform.Rows[0]["outqty"].ToString()) > int.Parse(dtform.Rows[0]["getqty"].ToString()))
|
|
|
{
|
|
|
dh.UpdateByCondition("prodinout", "pi_pdastatus='备货中'", "pi_inoutno='" + pi_inoutno.Text + "'");
|
|
|
+ OperateResult.AppendText("出货单" + pi_inoutno.Text + "备货成功\n", Color.Black,input);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
dh.UpdateByCondition("prodinout", "pi_pdastatus='已备货'", "pi_inoutno='" + pi_inoutno.Text + "'");
|
|
|
- OperateResult.AppendText("出货单" + pi_inoutno.Text + "已完成备货\n", Color.Black);
|
|
|
+ OperateResult.AppendText("出货单" + pi_inoutno.Text + "已完成备货\n", Color.Black,input);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
else if (dta.Rows[0]["pi_type"].ToString() == "自由出货")
|
|
|
{
|
|
|
dh.UpdateByCondition("prodinout", "pi_pdastatus='备货中'", "pi_inoutno='" + pi_inoutno.Text + "'");
|
|
|
+ OperateResult.AppendText("出货单" + pi_inoutno.Text + "备货成功\n", Color.Black,input);
|
|
|
}
|
|
|
+ LoadFormData();
|
|
|
+ LoadGridData();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -287,6 +339,7 @@ namespace UAS_MES.Warehouse
|
|
|
{
|
|
|
dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode='" + input.Text + "' and pim_type='PALLET'", "delete");
|
|
|
dh.UpdateByCondition("package", "pa_outno=''", "pa_outboxcode='"+input.Text+ "'");
|
|
|
+ OperateResult.AppendText("栈板号" + input.Text + "取消备货成功\n", Color.Black,input);
|
|
|
}
|
|
|
else {
|
|
|
OperateResult.AppendText("栈板号" + input.Text + "不在备货数据中\n", Color.Red,input);
|
|
|
@@ -302,6 +355,7 @@ namespace UAS_MES.Warehouse
|
|
|
{
|
|
|
dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode='" + input.Text + "' and pim_type='BOX'", "delete");
|
|
|
dh.UpdateByCondition("package", "pa_outno=''", "pa_outboxcode='" + input.Text + "'");
|
|
|
+ OperateResult.AppendText("箱号" + input.Text + "取消备货成功\n", Color.Black, input);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -325,6 +379,7 @@ namespace UAS_MES.Warehouse
|
|
|
{
|
|
|
dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_mac='" + input.Text + "'", "delete");
|
|
|
dh.UpdateByCondition("makeserial", "ms_iostatus=1", "ms_sncode='"+input.Text+"' and ms_prodcode='"+ dt.Rows[0]["pim_prodcode"].ToString() + "' and ms_iostatus=2");
|
|
|
+ OperateResult.AppendText("序列号" + input.Text + "取消备货成功\n", Color.Black, input);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -333,6 +388,13 @@ namespace UAS_MES.Warehouse
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("未选择录入数据类型\n", Color.Red, input);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ LoadFormData();
|
|
|
+ LoadGridData();
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -347,8 +409,8 @@ namespace UAS_MES.Warehouse
|
|
|
{
|
|
|
//更新操作
|
|
|
sql.Clear();
|
|
|
- sql.Append("insert into prodiomac(pim_id,pim_inoutno,pim_piid,pim_prodcode,pim_mac,pim_indate,pim_inman)");
|
|
|
- sql.Append("values(prodiomac_seq.nextval,'" + pi_inoutno.Text + "','" + pi_id.Text + "','" + dtms.Rows[0]["ms_prodcode"].ToString() + "','" + input.Text + "',sysdate,'" + User.UserCode + "')");
|
|
|
+ sql.Append("insert into prodiomac(pim_id,pim_inoutno,pim_piid,pim_prodcode,pim_mac,pim_indate,pim_inman,pim_type)");
|
|
|
+ sql.Append("values(prodiomac_seq.nextval,'" + pi_inoutno.Text + "','" + pi_id.Text + "','" + dtms.Rows[0]["ms_prodcode"].ToString() + "','" + input.Text + "',sysdate,'" + User.UserCode + "',' ')");
|
|
|
dh.ExecuteSql(sql.GetString(), "insert");
|
|
|
dh.UpdateByCondition("makeserial", "ms_iostatus=2", " ms_id='" + ms_id + "'");
|
|
|
}
|
|
|
@@ -382,7 +444,7 @@ namespace UAS_MES.Warehouse
|
|
|
OperateResult.AppendText(type + input.Text + "内序列号未完工,序列号:" + dt.Rows[0]["data"].ToString() + "\n", Color.Red, input);
|
|
|
return;
|
|
|
}
|
|
|
- if (dta.Rows[0]["pi_type"].ToString() == "订单出库")
|
|
|
+ if (dta.Rows[0]["pi_type"].ToString() == "按订单出货")
|
|
|
{
|
|
|
sql.Clear();
|
|
|
sql.Append("select ms_prodcode,ms_salecode,cn from (select ms_prodcode,ms_salecode,count(1)cn from mes_package_view left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode='" + input.Text + "' ");
|
|
|
@@ -430,5 +492,36 @@ namespace UAS_MES.Warehouse
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ private void Clean_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select nvl(pi_pdastatus,'未备货')pi_pdastatus,pi_id from prodinout where pi_inoutno='" + pi_inoutno.Text + "'");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ if (dt.Rows[0]["pi_pdastatus"].ToString() == "已出库")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("出货单" + pi_inoutno.Text + "已经出库,不允许取消明细\n", Color.Red);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if (dt.Rows[0]["pi_pdastatus"].ToString() == "未备货")
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("出货单" + pi_inoutno.Text + "尚未备货,无法取消明细\n", Color.Red);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ dh.ExecuteSql("update makeserial set ms_iostatus=1 where exists (select 1 from prodiomac where pim_inoutno='" + pi_inoutno.Text + " ' and pim_mac=ms_sncode and pim_prodcode=ms_prodcode and nvl(pim_outboxcode,' ')=' ') and ms_status=2", "update");
|
|
|
+ dh.ExecuteSql("update package set pa_outno = '' where exists (select 1 from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode=pa_outboxcode and ((pim_type='PALLET' AND PA_TYPE=3) OR (PIM_TYPE='BOX' AND PA_TYPE IN(1,2)))) AND PA_OUTNO='" + pi_inoutno.Text + "'", "update");
|
|
|
+ dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "'", "delete");
|
|
|
+ dh.ExecuteSql("update prodinout set pi_pdastatus='未备货' where pi_inoutno='" + pi_inoutno.Text + "'", "update");
|
|
|
+ dh.ExecuteSql("insert into messagelog(ml_id,ml_date,ml_man,ml_content,ml_result,ml_search)values(messagelog_seq.nextval,sysdate,'" + User.UserName+ "','清除全部备货明细',''清除备货明细成功'','ProdInOut!Sale|pi_id=" + pi_id.Text+"')", "insert");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ OperateResult.AppendText("出货单" + pi_inoutno.Text + "不存在\n", Color.Red, pi_inoutno);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ LoadFormData();
|
|
|
+ LoadGridData();
|
|
|
+ }
|
|
|
}
|
|
|
}
|