订单查询,出货撤销与,工单查询功能修改
This commit is contained in:
@@ -400,7 +400,6 @@ namespace DOAN.Service.BZFM
|
||||
Context.Insertable(newRecord).ExecuteCommand();
|
||||
Context.Ado.CommitTran();
|
||||
return "ok";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -477,10 +476,7 @@ namespace DOAN.Service.BZFM
|
||||
Context.Insertable(newRecord).ExecuteCommand();
|
||||
Context.Ado.CommitTran();
|
||||
return "ok";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -891,10 +887,11 @@ namespace DOAN.Service.BZFM
|
||||
{
|
||||
int _type = parm.Type;
|
||||
int _id = parm.Id;
|
||||
if (_type < -1 && _id < -1)
|
||||
if (_type < -1 || _id < -1)
|
||||
{
|
||||
return $"传入参数有误,请检查:type-{_type},id-{_id}";
|
||||
}
|
||||
|
||||
// type == 1 入库单
|
||||
if (_type == 1)
|
||||
{
|
||||
@@ -953,6 +950,7 @@ namespace DOAN.Service.BZFM
|
||||
{
|
||||
return $"此记录已撤销过,不可重复撤销";
|
||||
}
|
||||
|
||||
//做出库红单
|
||||
OutboundReceiptDto revokeRecepitDto = new()
|
||||
{
|
||||
@@ -970,20 +968,73 @@ namespace DOAN.Service.BZFM
|
||||
Remarks = $"撤销操作,出库单号:{recordOutbound.OutboundNo}",
|
||||
};
|
||||
string result = CreateOutboundReceipt(revokeRecepitDto);
|
||||
if (result == "ok")
|
||||
{
|
||||
recordOutbound.Remarks = "已撤销";
|
||||
Context.Updateable(recordOutbound).ExecuteCommand();
|
||||
return result;
|
||||
}
|
||||
else
|
||||
if(result != "ok")
|
||||
{
|
||||
return result;
|
||||
}
|
||||
// 如果是出货则还要减少出货单库存
|
||||
Context.Ado.BeginTran();
|
||||
if (recordOutbound.TransactionType == "出货出库")
|
||||
{
|
||||
var workorderInfo = Context
|
||||
.Queryable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == recordOutbound.Workorder)
|
||||
.First();
|
||||
if (workorderInfo == null)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
return "工单不存在";
|
||||
}
|
||||
// 判断订单号是否存在
|
||||
var orderPurchase = Context
|
||||
.Queryable<OrderPurchase>()
|
||||
.Where(o => o.OrderNoMes == workorderInfo.CustomerOrder)
|
||||
.First();
|
||||
if (orderPurchase == null)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
return "订单号不存在";
|
||||
}
|
||||
Context
|
||||
.Updateable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == recordOutbound.Workorder)
|
||||
.SetColumns(it => it.ShipmentNum == 0)
|
||||
.SetColumns(it => it.CustomerOrder == string.Empty)
|
||||
.ExecuteCommand();
|
||||
// 修改采购订单是否完成
|
||||
int newQuantity =
|
||||
Context
|
||||
.Queryable<ProWorkorder>()
|
||||
.Where(it => it.CustomerOrder == orderPurchase.OrderNoMes)
|
||||
.Sum(it => it.ShipmentNum)
|
||||
?? 0;
|
||||
orderPurchase.DeliveryQuantity = newQuantity;
|
||||
if (orderPurchase.DeliveryQuantity > orderPurchase.DemandQuantity)
|
||||
{
|
||||
// 订单超额了
|
||||
Context.Ado.RollbackTran();
|
||||
return "订单超额了";
|
||||
}
|
||||
if (orderPurchase.DeliveryQuantity == orderPurchase.DemandQuantity)
|
||||
{
|
||||
orderPurchase.Orderindicator = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
orderPurchase.Orderindicator = -1;
|
||||
}
|
||||
int res = Context.Updateable(orderPurchase).ExecuteCommand();
|
||||
}
|
||||
|
||||
recordOutbound.Remarks = "已撤销";
|
||||
Context.Updateable(recordOutbound).ExecuteCommand();
|
||||
Context.Ado.CommitTran();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
return e.Message;
|
||||
}
|
||||
}
|
||||
@@ -1191,7 +1242,7 @@ namespace DOAN.Service.BZFM
|
||||
}
|
||||
else
|
||||
{
|
||||
orderPurchase.Orderindicator = 0;
|
||||
orderPurchase.Orderindicator = -1;
|
||||
}
|
||||
Context.Updateable(orderPurchase).ExecuteCommand();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user