using MES.Service.DB;
|
using MES.Service.Dto.webApi;
|
using MES.Service.Modes;
|
|
namespace MES.Service.service.BasicData;
|
|
public class ShipmentNoticeManager : Repository<ShipmentNotice>
|
{
|
private readonly ShipmentDetailManager shipmentDetailManager = new();
|
|
//当前类已经继承了 Repository 增、删、查、改的方法
|
public bool Save(ErpShipment shipment)
|
{
|
var shipmentNotice = GetShipmentNotice(shipment.ShipmentNotice);
|
|
var shipmentDetails = GetShipmentDetails(shipment.ShipmentDetails);
|
|
return false;
|
}
|
|
private ShipmentNotice GetShipmentNotice(ErpShipmentNotice notice)
|
{
|
var entity = new ShipmentNotice();
|
|
entity.Creator = notice.FCreatorId;
|
entity.DocId = notice.FBillNo;
|
entity.Approver = notice.FApproverID;
|
|
if (notice.FCreateDate != null)
|
entity.CreateDate = DateTime.ParseExact(notice.FCreateDate,
|
"yyyy-MM-dd HH:mm:ss", null);
|
|
if (notice.FApproveDate != null)
|
entity.ApproveDate = DateTime.ParseExact(notice.FApproveDate,
|
"yyyy-MM-dd HH:mm:ss", null);
|
|
entity.DeptCode = notice.FSaleDeptId;
|
entity.CustCode = notice.FCustomerID;
|
entity.ListNote = notice.FNote;
|
entity.RepCode = notice.FSalesManID;
|
|
return entity;
|
}
|
|
private List<ShipmentDetail> GetShipmentDetails(
|
List<ErpShipmentDetail> shipmentDetails)
|
{
|
return shipmentDetails.Select(s =>
|
{
|
var entity = new ShipmentDetail
|
{
|
ErpId = s.ErpId,
|
ErpHeadId = s.ErpHeadId,
|
ProdCode = s.FMaterialID,
|
ProdName = s.FMaterialName,
|
Amount = Convert.ToDouble(s.FAmount),
|
UnitPrice = Convert.ToDouble(s.FPrice),
|
Quantity = Convert.ToDouble(s.FQty),
|
BatchNo = s.FLot,
|
Remarks = s.FNoteEntry,
|
OrderNo = s.F_UNW_Text_xsddh,
|
OrderId = s.FSOEntryId,
|
BasePrice = Convert.ToDouble(s.FPrice),
|
WarehouseCode = s.FStockID,
|
Unit = s.FBaseUnitID
|
};
|
return entity;
|
}).ToList();
|
}
|
}
|