This commit is contained in:
余宇波 2025-06-05 17:26:42 +08:00
parent bdae3f56af
commit 70ab6b9162
3 changed files with 30 additions and 185 deletions

View File

@ -135,5 +135,19 @@ namespace MyCode.Project.Domain.Model
/// </summary>
public string FBillNo {get;set;}
/// <summary>
/// Desc:销售订单号
/// Default:
/// Nullable:True
/// </summary>
public string Fdemandbillno {get;set;}
/// <summary>
/// Desc:备注
/// Default:
/// Nullable:True
/// </summary>
public string Remart {get;set;}
}
}

View File

@ -256,7 +256,7 @@ namespace MyCode.Project.Services.Implementation
{
throw new BaseException("每包数量必须大于0");
}
//_tiaoMaRepository.Delete(t => t.InvoceOrderItemId == act.Id);
//_tiaoMaRepository.Delete(t => t.InvoceOrderItemId == act.Id); purchaseOrderItem.F_TSPR_Text_qtr1
var orderItem = _invoiceOrderItemRepository.Queryable().Where(t => t.Id == act.Id).First();
if (orderItem == null)
{
@ -267,6 +267,12 @@ namespace MyCode.Project.Services.Implementation
{
throw new BaseException("不正确的ID数据");
}
var purchaseOrderItem = _purchaseOrderItemRepository.Queryable().Where(t => t.Id == orderItem.PurchaseOrderItemId).First();
if (purchaseOrderItem == null)
{
throw new BaseException("不正确的ID数据");
}
List<TiaoMaList> addList = new List<TiaoMaList>();
if (orderItem.CuseQty == act.CuseQty)
{
@ -276,6 +282,8 @@ namespace MyCode.Project.Services.Implementation
{
t.SupplierId = order.SupplierId;
t.SupplierName = order.SupplierName;
t.Fdemandbillno = purchaseOrderItem.F_TSPR_Text_qtr1;
t.Remart = purchaseOrderItem.Remark;
});
@ -310,6 +318,8 @@ namespace MyCode.Project.Services.Implementation
tiaoMa.SupplierId = order.SupplierId;
tiaoMa.SupplierName = order.SupplierName;
tiaoMa.InvoceOrderItemId = orderItem.Id;
tiaoMa.Fdemandbillno = purchaseOrderItem.F_TSPR_Text_qtr1;
tiaoMa.Remart = purchaseOrderItem.Remark;
addList.Add(tiaoMa);
}
if (yu > 0)
@ -326,6 +336,8 @@ namespace MyCode.Project.Services.Implementation
tiaoMa.SupplierId = order.SupplierId;
tiaoMa.SupplierName = order.SupplierName;
tiaoMa.InvoceOrderItemId = orderItem.Id;
tiaoMa.Fdemandbillno = purchaseOrderItem.F_TSPR_Text_qtr1;
tiaoMa.Remart = purchaseOrderItem.Remark;
addList.Add(tiaoMa);
}
if (addList.Count > 0)
@ -345,8 +357,8 @@ namespace MyCode.Project.Services.Implementation
FSupplierLot = t.FSupplierLot == null ? "" : t.FSupplierLot,
FMaterialId = t.MaterialCode,
FLot = t.MSSSupplierLot,
FQty = t.Qty.Value.ToString()
}).ToList();
FQty = t.Qty.Value.ToString(),
}).ToList();
_workProcessService.Add<IKingDeeService>(this.MerchantId, "AddTiaoMa", "生成条码档案", JsonHelper.ToJson(addTiaoMas), 5);
}

View File

@ -298,188 +298,7 @@ namespace MyCode.Project.Services.Implementation
}
#endregion
//#region BatchAddInvoiceOrder(选中明细生成发货通知单)
///// <summary>
///// 选中明细生成发货通知单
///// </summary>
///// <param name="updateList"></param>
///// <param name="loginInfo"></param>
///// <exception cref="BaseException"></exception>
//[TransactionCallHandler]
//public string BatchAddInvoiceOrderOld(AddOrder act , LoginInfo loginInfo)
//{
// if (!act.FaHuoDate.HasValue)
// act.FaHuoDate = DateTime.Now;
// List<UpdateQty> updateList = act.UpDateList;
// string supplierId = loginInfo.SupplierId;
// var ids = updateList.Select(t => t.Id).ToList(); ;
// var list = _purchaseOrderItemRepository.Queryable().Where(t => t.SupplierId == supplierId && ids.Contains(t.Id)).ToList();
// var fidList = list.Select(t => t.Fid).ToList();
// var orderHeadList = _purchaseOrderRepository.Queryable().Where(t => fidList.Contains( t.FiD)).ToList();
// if (orderHeadList == null)
// {
// throw new BaseException("订单不属于此供应商");
// }
// var FPurchaseOrgIdList = orderHeadList.Select(t => t.FPurchaseOrgId).Distinct().ToList();
// if (FPurchaseOrgIdList.Count > 1)
// {
// throw new BaseException("不能跨采购组织创建发货通知单");
// }
// if (loginInfo.IfForeign == 1 && string.IsNullOrWhiteSpace(act.F_VHUB_Text))
// {
// throw new BaseException("国外的供应商发票号和发票日期是必填.");
// }
// InvoiceOrder NewInvoiceOrder = new InvoiceOrder();
// NewInvoiceOrder.Id = Guid.NewGuid();
// NewInvoiceOrder.FiD = null;
// NewInvoiceOrder.Status = 1;
// NewInvoiceOrder.EditTime = DateTime.Now;
// NewInvoiceOrder.Editor = loginInfo.Name;
// NewInvoiceOrder.CreateTime = DateTime.Now;
// NewInvoiceOrder.Creater = loginInfo.Name;
// NewInvoiceOrder.SupplierId = supplierId;
// NewInvoiceOrder.SupplierName = orderHeadList.FirstOrDefault().SupplierName;
// NewInvoiceOrder.FDate = act.FaHuoDate;
// NewInvoiceOrder.Sheet = DateTime.Now.ToString("yyMMddhhmmssfff");
// NewInvoiceOrder.PurchaseOrderId = 0;
// NewInvoiceOrder.F_VHUB_Text = act.F_VHUB_Text;
// NewInvoiceOrder.F_URXD_Date = act.F_URXD_Date;
// NewInvoiceOrder.FPurchaseOrgId = orderHeadList.FirstOrDefault().FPurchaseOrgId;
// NewInvoiceOrder.FPurchaseOrgName = orderHeadList.FirstOrDefault().FPurchaseOrgName;
// List<InvoiceOrderItem> invoiceOrderItems = new List<InvoiceOrderItem>();
// //invoiceOrderItems=list.Select(t=>new InvoiceOrderItem {Id=Guid.NewGuid(), Amount1=t.Amount1, Amount2=t.Amount2,t })
// var allInvoiceOrderItem = _invoiceOrderItemRepository.Queryable().Where(t => ids.Contains(t.PurchaseOrderItemId.Value)).ToList();
// List<string> errorList = new List<string>();
// string FormId = "PUR_PurchaseOrder";
// var entityIdList = list.Select(t => t.EntityId).ToList();
// BillPush billPush = new BillPush();
// billPush.EntryIds = string.Join(",", entityIdList);
// billPush.TargetFormId = "PUR_ReceiveBill";
// billPush.IsEnableDefaultRule = true;
// billPush.CustomParams = new CustomParams();
// billPush.CustomParams.AutoAudit = false;
// billPush.CustomParams.ScanEntry = new List<ScanEntry>();
// List<AddTiaoMa> addTiaoMas = new List<AddTiaoMa>();
// list.ForEach(t =>
// {
// //var allqty = allInvoiceOrderItem.Where(h => h.PurchaseOrderItemId == t.Id ).Sum(h => h.Qty).SafeValue();
// var temp = updateList.Where(h => h.Id == t.Id).FirstOrDefault();
// if (temp != null)
// {
// var purchaseOrder = orderHeadList.FirstOrDefault(h=>h.FiD==t.Fid);
// if (purchaseOrder == null)
// throw new BaseException("找不到对应的采购订单主表信息");
// if ((temp.Qty ) > (t.Qty - t.MSSReceiveQty))
// {
// string error = $@"{t.MaterialName}";
// errorList.Add(error);
// }
// //else if ((temp.Qty + allqty) == t.Qty)
// //{
// //}
// else
// {
// InvoiceOrderItem invoiceOrderItemTemp = new InvoiceOrderItem();
// invoiceOrderItemTemp.Id = Guid.NewGuid();
// invoiceOrderItemTemp.InvoiceOrderId = NewInvoiceOrder.Id;
// invoiceOrderItemTemp.NewChengNuoJiaoQi = t.NewChengNuoJiaoQi;
// invoiceOrderItemTemp.ChengNuoJiaoQi = t.ChengNuoJiaoQi;
// invoiceOrderItemTemp.UnitPrice = t.UnitPrice;
// invoiceOrderItemTemp.PurchaseOrderId = t.Fid;
// invoiceOrderItemTemp.MaterialCode = t.MaterialCode;
// invoiceOrderItemTemp.MaterialName = t.MaterialName;
// invoiceOrderItemTemp.Amount1 = t.UnitPrice * temp.Qty;
// invoiceOrderItemTemp.Amount2 = t.UnitPrice * temp.Qty * t.TaxRate;
// invoiceOrderItemTemp.DeliveryDate = act.FaHuoDate;
// invoiceOrderItemTemp.Qty = temp.Qty;
// invoiceOrderItemTemp.Remark = t.Remark;
// invoiceOrderItemTemp.SpecificationModel = t.SpecificationModel;
// invoiceOrderItemTemp.TaxAmount = t.TaxAmount;
// invoiceOrderItemTemp.PurchaseOrderItemId = t.Id;
// invoiceOrderItemTemp.FSupplierLot = temp.FSupplierLot==null ?"" : temp.FSupplierLot;
// invoiceOrderItemTemp.MSSSupplierLot = t.MSSSupplierLot;
// invoiceOrderItemTemp.UnitName = t.UnitName;
// invoiceOrderItemTemp.FBillNo = purchaseOrder.FBillNo;
// invoiceOrderItemTemp.PurchaseEntityId = t.EntityId;
// invoiceOrderItems.Add(invoiceOrderItemTemp);
// ScanEntry tempUpdate = new ScanEntry();
// tempUpdate.Qty = (int)temp.Qty;
// tempUpdate.FENTRYID = t.EntityId.SafeValue();
// tempUpdate.FSupplierLot = temp.FSupplierLot;
// billPush.CustomParams.ScanEntry.Add(tempUpdate);
// billPush.CustomParams.FPH= act.F_VHUB_Text;
// billPush.CustomParams.F_URXD_Date = act.F_URXD_Date;
// if (string.IsNullOrWhiteSpace(billPush.CustomParams.F_URXD_Date))
// billPush.CustomParams.F_URXD_Date = null;
// t.FReceiveQty = t.FReceiveQty + temp.Qty;
// t.FRemainReceiveQty = t.FRemainReceiveQty - temp.Qty;
// }
// }
// });
// if (errorList.Count > 0)
// {
// string e = string.Join(",", errorList);
// if(loginInfo.IfForeign==0)
// e = e + "的总发货数量大于总采购数量,请检查";
// else
// e=e+" The delivery QTY exceeds the PO's maximum QTY!";
// throw new BaseException(e);
// }
// else
// {
// try
// {
// var resultKD= _kingDeeService.Push(FormId, billPush);
// LogHelper.Info("推送收料订单");
// LogHelper.Info(resultKD);
// //var sda = resultKD.GetProperty("IsSuccess") [["SuccessEntitys"];
// dynamic data = JsonHelper.ToObject<dynamic>(resultKD);
// int row = 0;
// foreach (var item in data)
// {
// NewInvoiceOrder.FBillNo = item["Number"];
// NewInvoiceOrder.FiD = item["Id"];
// row++;
// }
// _invoiceOrderRepository.Add(NewInvoiceOrder);
// _invoiceOrderItemRepository.Add(invoiceOrderItems);
// _purchaseOrderItemRepository.Update(list);
// ////物料编码数量收料通知单号供应商批号key
// //AddTiaoMa addTiao = new AddTiaoMa();
// //addTiaoMas = invoiceOrderItems.Select(t => new AddTiaoMa {
// // FBarCode = $@"{t.MaterialCode}*{t.Qty.Value.ToString("F2")}*{NewInvoiceOrder.FBillNo}*{t.FSupplierLot}"
// //, FBarCodeRule= "03", FBillCode= NewInvoiceOrder.FBillNo, FSupplierLot=t.FSupplierLot==null?"": t.FSupplierLot, FMaterialId=t.MaterialCode, FQty=t.Qty.Value.ToString()
// //}).ToList();
// _workProcessService.Add<IInvoiceOrderService>(this.MerchantId, "SetMSSSupplierLot", "写入金蝶的美塞斯批号", NewInvoiceOrder.Sheet, 1);
// }
// catch (Exception ex)
// {
// LogHelper.Error("推送收料订单出错");
// LogHelper.Error(ex);
// throw new BaseException(ex.Message);
// }
// }
// return NewInvoiceOrder.Sheet;
//}
//#endregion
/// <summary>
/// 抓取金蝶的采购订单
/// </summary>