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.

116 lines
3.6 KiB

3 years ago
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Stone.Entity;
using Stone.DataService.Biz.BizPublic;
using Gm_WMS.DataAccess.DataService;
using Stone.DataService.Biz.Info;
namespace Stone.DataService.Biz.Bill
{
public class F_BillAsn
{
public F_BillAsn()
{
}
public DataSet BillNew(Command cmd)
{
string AsnNumber = cmd.Pars[0];
string UserName = cmd.Pars[1];
Entity_t_JIS_VDA t_JIS_VDA = new Entity_t_JIS_VDA();
DataSet dsData = t_JIS_VDA.GetData(
$"PackageNo, 0 as IsCheck, AsnNumber, IsShipingVerification,IsPrintASN",
3 years ago
$"[AsnNumber]='{AsnNumber}'",
$"[PackageNo] desc");
if (dsData.Tables[0].Rows.Count == 0)
{
throw new Exception($"ASN编号{AsnNumber}不存在");
}
if (dsData.Tables[0].Select("[IsPrintASN]=True").Length == 0)
throw new Exception($"{AsnNumber} 未打印");
3 years ago
if (dsData.Tables[0].Select("[IsShipingVerification]=False").Length == 0)
throw new Exception($"{AsnNumber} 已经完成发货校验");
return dsData;
}
public void BillSubmit(Command cmd, DataSet dsData)
{
string UserName = cmd.Pars[0];
if (dsData.Tables[0].Rows.Count == 0)
throw new Exception("提交的数据不能为空!");
string AsnNumber = dsData.Tables[0].Rows[0]["AsnNumber"].ToString();
LocalDBService db = null;
try
{
db = new LocalDBService();
db.BeginTrans();
Entity_t_JIS_VDA t_JIS_VDA = new Entity_t_JIS_VDA(db);
Entity_t_ShipingVerification t_ShipingVerification = new Entity_t_ShipingVerification(db);
DataTable dtVDA = t_JIS_VDA.GetData("", $"[AsnNumber]='{AsnNumber}'", "[PackageNo] asc").Tables[0];
if (dtVDA.Rows.Count == 0)
throw new Exception($"{AsnNumber} 在系统中不存在");
DataRow[] drs = dtVDA.Select($"[IsPackingVerification]=False");
if(drs.Length > 0)
{
string msg = "";
foreach(DataRow dr in drs)
{
msg += dr["PackageNo"].ToString() + ",";
}
if(msg != "")
{
throw new Exception($"未做装箱校验:{msg}");
}
}
if (dtVDA.Select($"[IsShipingVerification]=False").Length == 0)
throw new Exception($"{AsnNumber} 已经完成发货校验");
foreach (DataRow drData in dsData.Tables[0].Rows)
{
t_JIS_VDA.Edit(
$"[IsShipingVerification]=1",
$"[PackageNo]='{drData["PackageNo"]}'");
DataRow drNew = t_ShipingVerification.Table.NewRow();
drNew["AsnNumber"] = drData["AsnNumber"].ToString();
drNew["PackageNo"] = drData["PackageNo"].ToString();
drNew["UserName"] = UserName;
t_ShipingVerification.Add(drNew);
}
db.Commit();
}
catch (Exception ex)
{
if (db != null) db.Rollback();
throw ex;
}
finally
{
if (db != null) db.EndTrans();
}
}
}
}