| | |
| | | { |
| | | //如果客户编码为空 |
| | | prodTemp = input.Label; |
| | | if (ltemp != null && (ltemp.PROD_CODE.IsNullOrEmpty() || ltemp.PROD_CODE != input.Label.PROD_CODE)) |
| | | if (ltemp != null && ltemp.PROD_CODE.IsNullOrEmpty() && ltemp.PROD_CODE != input.Label.PROD_CODE) |
| | | { |
| | | prodTemp.LABEL_CODE = GenerateCodeName(input.Label.LABEL_CODE, "_L"); |
| | | } |
| | | } |
| | | var labelVarIds = input.LabelVars.Select(x => x.VAR_NAME).ToList(); |
| | | var labelVars = Biz.Db.Queryable<BAS_LABEL_VAR>() |
| | | .Where(q=> q.LABEL_ID == ltemp.ID) |
| | | .WhereIF(labelVarIds.Count>0, q=> !labelVarIds.Contains(q.VAR_NAME)) |
| | | .ToList(); |
| | | var db = Biz.Db; |
| | | var dbTran = db.UseTran(() => |
| | | { |
| | |
| | | x.LABEL_CODE == input.Label.LABEL_CODE && |
| | | x.PROD_CODE == input.Label.PROD_CODE && |
| | | x.CUST_CODE == input.Label.CUST_CODE).First(); |
| | | //删除不在传入列表中的 |
| | | if (labelVars.Count>0) |
| | | { |
| | | db.Deleteable(labelVars).ExecuteCommand(); |
| | | } |
| | | if (input.LabelVars != null && input.LabelVars.Count > 0) |
| | | { |
| | | if (temp != null && temp.ID != input.LabelVars[0].LABEL_ID) |
| | |
| | | z.AsInsertable.ExecuteCommand(); |
| | | z.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); |
| | | } |
| | | if (!input.LabelVars.Any()) |
| | | { |
| | | db.Deleteable(labelVars).ExecuteCommand(); |
| | | } |
| | | if (input.LabelVarWos != null && input.LabelVarWos.Count > 0) |
| | | { |
| | | if (temp != null && temp.ID != input.LabelVarWos[0].LABEL_ID) |