| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.entity.dto.PoItemsDto; |
| | | import com.vincent.rsf.server.api.service.ReportMsgService; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderItemMapper; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderMapper; |
| | | import com.vincent.rsf.server.manager.mapper.PurchaseMapper; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.PurchaseService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.service.FieldsItemService; |
| | | import com.vincent.rsf.server.system.service.FieldsService; |
| | | import com.vincent.rsf.server.system.utils.ExtendFieldsUtils; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("asnOrderItemService") |
| | | public class AsnOrderItemServiceImpl extends ServiceImpl<AsnOrderItemMapper, AsnOrderItem> implements AsnOrderItemService { |
| | |
| | | |
| | | @Autowired |
| | | private FieldsItemService fieldsItemService; |
| | | |
| | | @Override |
| | | public R generateBarcode(List<Long> orders) { |
| | | if (Objects.isNull(orders) || orders.isEmpty()) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | List<AsnOrderItem> items = this.list(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getId, orders)); |
| | | if (items.isEmpty()) { |
| | | throw new CoolException("单据明细不存在!!"); |
| | | } |
| | | items.forEach(item -> { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_LABEL_CODE, item); |
| | | if (Objects.isNull(ruleCode) || StringUtils.isBlank(ruleCode)) { |
| | | throw new CoolException("系统错误,请检查「SYS_LABEL_CODE」标签规则是否存在"); |
| | | } |
| | | item.setTrackCode(ruleCode); |
| | | }); |
| | | if (!this.saveOrUpdateBatch(items)) { |
| | | throw new CoolException("生成条码失败!!"); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | |
| | | @Override |
| | | public boolean fieldsSave(Map<String, Object> params) { |
| | | //保存扩展字段 |
| | | ExtendFieldsUtils.saveFields(params); |
| | | AsnOrderItem asnOrderItem = JSONObject.parseObject(JSONObject.toJSONString(params), AsnOrderItem.class); |
| | | if (StringUtils.isBlank(asnOrderItem.getTrackCode())) { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_LABEL_CODE, asnOrderItem); |
| | | asnOrderItem.setTrackCode(ruleCode); |
| | | } |
| | | if (!this.saveOrUpdate(asnOrderItem)) { |
| | | throw new CoolException("收货通知单明细保存失败!!"); |
| | | } |
| | | //保存扩展字段 |
| | | try { |
| | | ExtendFieldsUtils.saveFields(params); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return true; |
| | | } |
| | | |