예제 #1
0
        public void MarkDelProduct(MES_M201_Plan_Detail temp)
        {
            var existsDetail = this.planDetailRepository.GetByID(temp.Id);

            if (existsDetail != null)
            {
                this.planDetailRepository.Delete(existsDetail);
                var materialList = planMaterialRepository.GetMany(i => i.PlanDetailId == existsDetail.Id).ToList();
                foreach (var material in materialList)
                {
                    this.planMaterialRepository.Delete(material);
                }
            }
        }
예제 #2
0
        public void Save(List <MES_M201_Plan_Material> materialList)
        {
            if (materialList.Count > 0)
            {
                Guid planDetailId = materialList[0].PlanDetailId;
                var  existList    = MES_M201_Plan_MaterialRepository.GetMany(i => i.PlanDetailId == planDetailId).ToList();
                foreach (var exist in existList)
                {
                    MES_M201_Plan_MaterialRepository.Delete(exist);
                }
            }
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

            foreach (var model in materialList)
            {
                model.CreateDt   = DateTime.Now;
                model.CreateUser = tempUser.UserName;
                model.CompCode   = tempUser.CompCode;
                model.Validate();
                this.MES_M201_Plan_MaterialRepository.Add(model);
            }
            this.runtimeService.Commit();
        }