You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
3.6 KiB
93 lines
3.6 KiB
using Stone.Common;
|
|
using Stone.Entity;
|
|
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;
|
|
|
|
namespace Stone.WinModule.Standard
|
|
{
|
|
public partial class frmASNScan : Form
|
|
{
|
|
public frmASNScan()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void frmPasswordVerify_Load(object sender, EventArgs e)
|
|
{
|
|
this.lblName.Text = $"请扫描ASN号进行发运";
|
|
}
|
|
|
|
private void txtPassword_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
try
|
|
{
|
|
string asnNumber = this.txtAsnNumber.Text.Trim();
|
|
Entity_t_JIS_VDA t_jis_vda = new Entity_t_JIS_VDA();
|
|
DataSet dsAsn = t_jis_vda.GetData("", "[AsnNumber]='" + asnNumber + "'", "ID asc");
|
|
if (dsAsn.Tables[0].Rows.Count == 0) throw new Exception("扫描的ASN无效!");
|
|
var dtAsn = dsAsn.Tables[0];
|
|
if (dtAsn.Select("[IsShipingVerification]=0").Length > 0)
|
|
{
|
|
//取未校验的
|
|
var needCheck = dtAsn.Select("IsPackingVerification = 0");
|
|
//允许设置零件号不进行校验,判断未校验的零件是否在清单中
|
|
Entity_t_PartPO t_partpo = new Entity_t_PartPO();
|
|
DataSet dsPartPO = t_partpo.GetData("", "1 = 1", "ID asc");
|
|
if (dsPartPO.Tables[0].Rows.Count == 0)
|
|
{
|
|
throw new Exception("ASN中有未进行装箱校验的明细,禁止操作发货!");
|
|
}
|
|
|
|
var dtpartPO = dsPartPO.Tables[0];
|
|
foreach (var row in needCheck)
|
|
{
|
|
var partCode = row["PartNumber"].ToString();
|
|
var partRow = dtpartPO.Select("Code = '" + partCode + "'");
|
|
if (partRow.Length != 1)
|
|
{
|
|
throw new Exception("系统未定义唯一的零件号 " + partCode + " !");
|
|
}
|
|
else
|
|
{
|
|
if (bool.Parse(partRow[0]["IsCheck"].ToString()))
|
|
{
|
|
throw new Exception("零件号 " + partCode + " 未通过装箱校验,禁止操作发货!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("扫描的ASN已发运!");
|
|
}
|
|
//保存数据
|
|
var db = new Gm_WMS.DataAccess.DataService.LocalDBService();
|
|
db.BeginTrans();
|
|
Entity_v_JIS_VDA t_JIS_VDA = new Entity_v_JIS_VDA(db);
|
|
t_JIS_VDA.Edit($"UpLoadTime='" + DateTime.Now + "',IsShipingVerification = 1", $"[AsnNumber]='{asnNumber}'");
|
|
db.Commit();
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|
|
|