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.
168 lines
6.5 KiB
168 lines
6.5 KiB
using Gm_WMS.DataAccess.DataService;
|
|
using Stone.Common;
|
|
using Stone.DataService.Biz.BizPublic;
|
|
using Stone.Entity;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Stone.DataService.Biz.Bill
|
|
{
|
|
public class F_STD_Check
|
|
{
|
|
public static DataSet VDA_Check_Submit(Command cmd)
|
|
{
|
|
string UserName = cmd.Pars[0];
|
|
string PackageNo1 = cmd.Pars[1];
|
|
string PackageNo2 = cmd.Pars[2];
|
|
string PartNumber = cmd.Pars[3];
|
|
int Qty = Convert.ToInt32(cmd.Pars[4]);
|
|
string BarCode = cmd.Pars[5];
|
|
|
|
string PackageNo = PackageNo1.Substring(0, PackageNo1.Length - 3);
|
|
string leftPackageNo2 = PackageNo2.Substring(0, PackageNo1.Length - 3);
|
|
|
|
string RightPackageNo1 = PackageNo1.Substring(PackageNo1.Length - 2);
|
|
string RightPackageNo2 = PackageNo2.Substring(PackageNo2.Length - 2);
|
|
|
|
LocalDBService db = null;
|
|
try
|
|
{
|
|
db = new LocalDBService();
|
|
db.BeginTrans();
|
|
|
|
Entity_t_JIS_VDA t_JIS_VDA = new Entity_t_JIS_VDA(db);
|
|
Entity_t_VerifyBill t_VerifyBill = new Entity_t_VerifyBill(db);
|
|
|
|
if (PackageNo != leftPackageNo2)
|
|
{
|
|
throw new Exception($"装箱单号1 {PackageNo1} 和装箱单号2{PackageNo2} 不匹配!");
|
|
}
|
|
|
|
if (RightPackageNo1 == RightPackageNo2)
|
|
{
|
|
throw new Exception($"装箱单号1 {PackageNo} 和装箱单号2{leftPackageNo2} 的流水号重复!");
|
|
}
|
|
else
|
|
{
|
|
if (RightPackageNo1 != "01" && RightPackageNo1 != "02")
|
|
{
|
|
throw new Exception($"装箱单号1 {PackageNo1} 的流水号无效!");
|
|
}
|
|
if (RightPackageNo2 != "01" && RightPackageNo2 != "02")
|
|
{
|
|
throw new Exception($"装箱单号1 {PackageNo2} 的流水号无效!");
|
|
}
|
|
}
|
|
|
|
DataTable dtVDA = t_JIS_VDA.GetData($"[PackageNo]='{PackageNo}'").Tables[0];
|
|
if (dtVDA.Rows.Count == 0)
|
|
throw new Exception($"装箱单号 {PackageNo} 在系统中不存在");
|
|
|
|
if (!Convert.ToBoolean(dtVDA.Rows[0]["IsPrintLabel"]))
|
|
throw new Exception($"装箱单号 {PackageNo} 未打印");
|
|
|
|
// if (Convert.ToBoolean(dtVDA.Rows[0]["IsPackingVerification"]))
|
|
// throw new Exception($"装箱单号 {PackageNo} 已经做过装箱校验了");
|
|
|
|
if (dtVDA.Rows[0]["PartNumber"].ToString().Trim().ToUpper() != PartNumber)
|
|
{
|
|
throw new Exception($"零件号{PartNumber}不正确,正确零件号为{dtVDA.Rows[0]["PartNumber"]}");
|
|
}
|
|
|
|
if (Convert.ToInt32(dtVDA.Rows[0]["Qty"]) != Qty)
|
|
{
|
|
throw new Exception($"数量{Qty}不正确,正确数量为{dtVDA.Rows[0]["Qty"]}");
|
|
}
|
|
|
|
t_JIS_VDA.Edit($"[IsPackingVerification]=1", $"[ID]={dtVDA.Rows[0]["ID"]}");
|
|
|
|
//if (t_VerifyBill.GetData($"[BarCode]='{BarCode}'").Tables[0].Rows.Count > 0)
|
|
// throw new Exception($"内部装箱单号 {BarCode} 重复扫描");
|
|
|
|
DataRow drVerify = t_VerifyBill.Table.NewRow();
|
|
drVerify["AsnNumber"] = dtVDA.Rows[0]["AsnNumber"].ToString();
|
|
drVerify["PackageNo"] = PackageNo;
|
|
drVerify["PackageNo1"] = PackageNo1;
|
|
drVerify["PackageNo2"] = PackageNo2;
|
|
drVerify["PartNumber"] = PartNumber;
|
|
drVerify["Qty"] = Qty;
|
|
drVerify["BarCode"] = BarCode;
|
|
drVerify["UserName"] = UserName;
|
|
t_VerifyBill.Add(drVerify);
|
|
|
|
db.Commit();
|
|
|
|
return Stone.DataService.Biz.BizPublic.MyDataSet.GetDataByString("OK");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (db != null) db.Rollback();
|
|
throw ex;
|
|
}
|
|
finally
|
|
{
|
|
if (db != null) db.EndTrans();
|
|
}
|
|
|
|
}
|
|
|
|
public DataSet VDA_UPDATE_Submit(Command cmd)
|
|
{
|
|
string UserName = cmd.Pars[0];
|
|
string VDA = cmd.Pars[1];
|
|
string BarCode = cmd.Pars[2];
|
|
LocalDBService db = null;
|
|
try
|
|
{
|
|
db = new LocalDBService();
|
|
db.BeginTrans();
|
|
Entity_t_VerifyBill t_VerifyBill = new Entity_t_VerifyBill(db);
|
|
var dsVerifyBill = t_VerifyBill.GetData($"[PackageNo1]='{VDA}' or [PackageNo2]='{VDA}'");
|
|
if(dsVerifyBill.Tables.Count == 0 || dsVerifyBill == null)
|
|
{
|
|
throw new Exception($"不存在 VDA标签 {VDA} 的校验记录!");
|
|
}
|
|
else
|
|
{
|
|
var oldBarCode = dsVerifyBill.Tables[0].Rows[0]["BarCode"].ToString();
|
|
if (BarCode != oldBarCode)
|
|
{
|
|
throw new Exception($"VDA标签 {VDA} 对应的内部条码号应为{oldBarCode}!");
|
|
}
|
|
}
|
|
var strID = dsVerifyBill.Tables[0].Rows[0]["ID"].ToString();
|
|
|
|
var strsql = "";
|
|
//更新为失效
|
|
strsql = "Update t_VerifyBill" +
|
|
" set State = '已失效'" +
|
|
" where PackageNo1 = '" + VDA + "' or PackageNo2 = '" + VDA + "'";
|
|
db.Exec_NonQuery(strsql);
|
|
|
|
//插入新记录
|
|
// strsql = "Insert into t_VerifyBill(AsnNumber,PackageNo,PackageNo1,PackageNo2,PartNumber,Qty,BarCode,UserName)" +
|
|
// " select AsnNumber,PackageNo,PackageNo1,PackageNo2,PartNumber,Qty,'" + BarCode + "'," +
|
|
// "'" + UserName + "'" +
|
|
// " from t_VerifyBill where ID = " + strID;
|
|
// db.Exec_NonQuery(strsql);
|
|
db.Commit();
|
|
|
|
return Stone.DataService.Biz.BizPublic.MyDataSet.GetDataByString("OK");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (db != null) db.Rollback();
|
|
throw ex;
|
|
}
|
|
finally
|
|
{
|
|
if (db != null) db.EndTrans();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|