| | |
| | | using WMS.BLL.LogServer; |
| | | using WMS.DAL; |
| | | using WMS.Entity.BllAsnEntity; |
| | | using WMS.Entity.BllQualityEntity; |
| | | using WMS.Entity.BllSoEntity; |
| | | using WMS.Entity.Context; |
| | | using WMS.Entity.DataEntity; |
| | |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 质量结果下发 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public void QualityResult(QualityResultVm model) |
| | | { |
| | | try |
| | | { |
| | | //验证批次号是否为空 |
| | | if (string.IsNullOrEmpty(model.LotNo)) |
| | | { |
| | | throw new Exception("批次号不可为空,请核查!"); |
| | | } |
| | | //开启事务 |
| | | Db.BeginTran(); |
| | | |
| | | BllQualityInspect inspectModel = new BllQualityInspect(); |
| | | inspectModel.InspectNo = ""; |
| | | inspectModel.ASNNo = ""; |
| | | inspectModel.LotNo = model.LotNo; |
| | | inspectModel.IsQualified = model.IsQualified; |
| | | inspectModel.Origin = "LIMS"; //来源 |
| | | inspectModel.CreateTime = Db.GetDate(); //创建日期 |
| | | inspectModel.SkuNo = ""; //物料号 |
| | | inspectModel.SkuName = ""; //物料名称 |
| | | inspectModel.PassQty = 0; //合格数量 |
| | | inspectModel.FailQty = 0; //不合格数量 |
| | | inspectModel.Standard = ""; //规格 |
| | | inspectModel.CreateUser = 0; |
| | | //插入质检信息 |
| | | Db.Insertable(inspectModel).ExecuteCommand(); |
| | | |
| | | //查找库存明细信息 |
| | | List<DataStockDetail> detail = Db.Queryable<DataStockDetail>().Where(m => m.IsDel == "0" && m.LotNo == model.LotNo).ToList(); |
| | | foreach (var item in detail) |
| | | { |
| | | item.InspectStatus = model.IsQualified == "1" ? "1" : "2";//0:待检验,1:合格,2:不合格 |
| | | |
| | | Db.Updateable(item).ExecuteCommand(); |
| | | } |
| | | |
| | | //提交事务 |
| | | Db.CommitTran(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //回滚事务 |
| | | Db.RollbackTran(); |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |