/// <summary> /// 插入变化后的商品信息 /// </summary> /// <param name="goodsDtos">所有数据</param> /// <param name="businessOrderCode">关联业务单号</param> /// <param name="requisitionType">业务类型</param> /// <returns></returns> public bool InsertGoodsChageOrderInfo(List <GoodsDto> goodsDtos, RequisitionType requisitionType) { if (goodsDtos == null || goodsDtos.Count <= 0) { return(false); } //事务防止多插入产生脏数据 var result = Db.Ado.UseTran(() => { //库存变化单id int goodsChageOrderId = Db.Insertable(new GoodsChageOrder { //用uuid当作新生成的领用单单号 code = Guid.NewGuid().ToString("N"), create_time = DateTime.Now, operator_id = 1, business_type = (int)requisitionType }).ExecuteReturnIdentity(); List <GoodsChageOrderdtl> goodsChageOrderdtls = goodsDtos.MapToListIgnoreId <GoodsDto, GoodsChageOrderdtl>(); goodsChageOrderdtls.ForEach(it => { it.related_order_id = goodsChageOrderId; }); Db.Insertable(goodsChageOrderdtls).ExecuteCommand(); }); return(result.IsSuccess); }
/// <summary> /// 生成领用单信息和库存变化单信息 /// </summary> /// <param name="goodsDtos">操作变化数据</param> /// <param name="requisitionType">业务类型</param> /// <param name="surgeryOrderCode">手术单号,如果是有单手术业务的情况</param> /// <returns></returns> public bool InsertFetchAndGoodsChangeInfo(List<GoodsDto> operateGoodsDtos, RequisitionType requisitionType, string surgeryOrderCode) { bool ret = false; string goodsChangeBusinessOrderCode = null; switch (requisitionType) { case RequisitionType.一般领用: ret = FetchOrderDal.InsertFetchOrderInfo(operateGoodsDtos, new GoodsChageAttribute { RequisitionType = requisitionType, RequisitionStatus = RequisitionStatus.已认领, ConsumablesStatus = ConsumablesStatus.已领用, }, null, out goodsChangeBusinessOrderCode); //生成存库变化单 if (ret) { ret = GoodsChangeOrderDal.InsertGoodsChageOrderInfo(operateGoodsDtos, goodsChangeBusinessOrderCode, requisitionType); } break; case RequisitionType.无单手术领用: ret = FetchOrderDal.InsertFetchOrderInfo(operateGoodsDtos, new GoodsChageAttribute { RequisitionType = requisitionType, RequisitionStatus = RequisitionStatus.待认领, ConsumablesStatus = ConsumablesStatus.已领用, }, null, out goodsChangeBusinessOrderCode); //生成存库变化单 if (ret) { ret = GoodsChangeOrderDal.InsertGoodsChageOrderInfo(operateGoodsDtos, goodsChangeBusinessOrderCode, requisitionType); } break; case RequisitionType.有单手术领用: ret = FetchOrderDal.InsertFetchOrderInfo(operateGoodsDtos, new GoodsChageAttribute { RequisitionType = requisitionType, RequisitionStatus = RequisitionStatus.已认领, ConsumablesStatus = ConsumablesStatus.已领用, }, surgeryOrderCode, out goodsChangeBusinessOrderCode); //生成存库变化单 if (ret) { ret = GoodsChangeOrderDal.InsertGoodsChageOrderInfo(operateGoodsDtos, goodsChangeBusinessOrderCode, requisitionType); } break; default: break; } return ret; }
public FileRequisition(string filename, int bytesLength, byte[] file, Guid storeCode, string fileType) { Filename = filename.Substring(0, filename.IndexOf(".")); FileExtension = filename.Substring(filename.IndexOf(".") + 1); FileSize = Convert.ToDecimal(bytesLength) / Convert.ToDecimal(1024); File = file; StoreCode = storeCode; RequisitionType = (RequisitionType)Enum.Parse(RequisitionType.GetType(), fileType); Status = RequisitionStatus.Pending.AsInt(); SaveDate = DateTime.Now; }
/// <summary> /// 插入变化后的商品信息 /// </summary> /// <param name="goodsDtos">所有数据</param> /// <param name="businessOrderCode">关联业务单号</param> /// <param name="requisitionType">业务类型</param> /// <returns></returns> public bool InsertGoodsChageOrderInfo(List <GoodsDto> goodsDtos, string businessOrderCode, RequisitionType requisitionType) { if (goodsDtos == null || goodsDtos.Count <= 0) { return(false); } //若有业务单号,则一次操作商品集,拼接该业务单号 goodsDtos.ForEach(it => { it.business_order_code = businessOrderCode; }); return(InsertGoodsChageOrderInfo(goodsDtos, requisitionType)); }