Commit d1585633 authored by 温志超's avatar 温志超

更新打印以及删除报工逻辑

parent c7d343ea
...@@ -319,10 +319,6 @@ public class ProTask extends BaseEntity { ...@@ -319,10 +319,6 @@ public class ProTask extends BaseEntity {
@ApiModelProperty("超报标识") @ApiModelProperty("超报标识")
private Boolean surpassState; private Boolean surpassState;
private String expectStartDateString;
private String requestDateString;
public String getStatusName() { public String getStatusName() {
return TaskStatusEnum.getStatusCn(this.getStatus()); return TaskStatusEnum.getStatusCn(this.getStatus());
} }
......
...@@ -4,5 +4,9 @@ import lombok.Data; ...@@ -4,5 +4,9 @@ import lombok.Data;
@Data @Data
public class TaskProPrintData extends ProTask{ public class TaskProPrintData extends ProTask{
private String beginAndEndDate;
private String expectStartDateString;
private String requestDateString;
} }
...@@ -358,8 +358,6 @@ public class ProFeedbackServiceImpl implements IProFeedbackService { ...@@ -358,8 +358,6 @@ public class ProFeedbackServiceImpl implements IProFeedbackService {
public int deleteProFeedbackByRecordIds(Long[] recordIds) { public int deleteProFeedbackByRecordIds(Long[] recordIds) {
List<ProFeedback> proFeedbacks = proFeedbackMapper.selectListByQw(new QueryWrapper<ProFeedback>().in("record_id", Arrays.asList(recordIds))); List<ProFeedback> proFeedbacks = proFeedbackMapper.selectListByQw(new QueryWrapper<ProFeedback>().in("record_id", Arrays.asList(recordIds)));
for (ProFeedback proFeedback : proFeedbacks) { for (ProFeedback proFeedback : proFeedbacks) {
BigDecimal quantityFeedback = proFeedback.getQuantityFeedback();
ProTask proTask = proTaskService.selectProTaskByTaskId(proFeedback.getTaskId()); ProTask proTask = proTaskService.selectProTaskByTaskId(proFeedback.getTaskId());
ExceptionUtil.checkTrueThrowException(proTask.getIsLastProcess() == 1, MessageUtils.message("pro.feedback.error.cannot.delete.last.process")); ExceptionUtil.checkTrueThrowException(proTask.getIsLastProcess() == 1, MessageUtils.message("pro.feedback.error.cannot.delete.last.process"));
...@@ -373,7 +371,8 @@ public class ProFeedbackServiceImpl implements IProFeedbackService { ...@@ -373,7 +371,8 @@ public class ProFeedbackServiceImpl implements IProFeedbackService {
proTaskWorkunit.setQuantityUnqualify(proTaskWorkunit.getQuantityUnqualify().subtract(proFeedback.getQuantityUnqualify())); proTaskWorkunit.setQuantityUnqualify(proTaskWorkunit.getQuantityUnqualify().subtract(proFeedback.getQuantityUnqualify()));
proTaskWorkunit.setQuantityQualify(proTaskWorkunit.getQuantityQualify().subtract(proFeedback.getQuantityQualify())); proTaskWorkunit.setQuantityQualify(proTaskWorkunit.getQuantityQualify().subtract(proFeedback.getQuantityQualify()));
proTaskWorkunit.setQuantityProduced(proTaskWorkunit.getQuantityProduced().subtract(proFeedback.getQuantityFeedback())); proTaskWorkunit.setQuantityProduced(proTaskWorkunit.getQuantityProduced().subtract(proFeedback.getQuantityFeedback()));
if (proTaskWorkunit.getQuantityProduced().doubleValue() < proTaskWorkunit.getQuantity().doubleValue()) { if (proTask.getQuantityWait().compareTo(BigDecimal.ZERO) > 0
&& proTaskWorkunit.getStatus().equals(TaskWorkunitStatusEnum.FINISHED.getStatus())) {
proTaskWorkunit.setStatus(TaskWorkunitStatusEnum.BEGINNING.getStatus()); proTaskWorkunit.setStatus(TaskWorkunitStatusEnum.BEGINNING.getStatus());
proTask.setTaskWorkunitId(proTaskWorkunit.getTaskWorkunitId()); proTask.setTaskWorkunitId(proTaskWorkunit.getTaskWorkunitId());
proTask.setWorkunitId(proTaskWorkunit.getWorkunitId()); proTask.setWorkunitId(proTaskWorkunit.getWorkunitId());
...@@ -383,7 +382,7 @@ public class ProFeedbackServiceImpl implements IProFeedbackService { ...@@ -383,7 +382,7 @@ public class ProFeedbackServiceImpl implements IProFeedbackService {
proTaskWorkunitService.updateProTaskWorkunit(proTaskWorkunit); proTaskWorkunitService.updateProTaskWorkunit(proTaskWorkunit);
ProTask nextProTask = proTaskService.getNextTaskByTaskId(proFeedback.getTaskId()); ProTask nextProTask = proTaskService.getNextTaskByTaskId(proFeedback.getTaskId());
if (nextProTask != null) { if (nextProTask != null) {
BigDecimal subtract = nextProTask.getQuantityWait().subtract(quantityFeedback); BigDecimal subtract = nextProTask.getQuantityWait().subtract(proFeedback.getQuantityQualify());
ExceptionUtil.checkTrueThrowException(subtract.doubleValue() < 0, MessageUtils.message("pro.feedback.error.error1")); ExceptionUtil.checkTrueThrowException(subtract.doubleValue() < 0, MessageUtils.message("pro.feedback.error.error1"));
nextProTask.setQuantityWait(subtract); nextProTask.setQuantityWait(subtract);
proTaskService.updateProTask(nextProTask); proTaskService.updateProTask(nextProTask);
...@@ -679,7 +678,7 @@ public class ProFeedbackServiceImpl implements IProFeedbackService { ...@@ -679,7 +678,7 @@ public class ProFeedbackServiceImpl implements IProFeedbackService {
ProFeedback oldFeedback = proFeedbacks.get(0); ProFeedback oldFeedback = proFeedbacks.get(0);
proFeedback.setFeedbackCode(oldFeedback.getFeedbackCode()); proFeedback.setFeedbackCode(oldFeedback.getFeedbackCode());
// BigDecimal feedbackQuantitySubtract = quantityFeedback.subtract(oldFeedback.getQuantityFeedback()); // BigDecimal feedbackQuantitySubtract = quantityFeedback.subtract(oldFeedback.getQuantityFeedback());
//
// if (feedbackQuantitySubtract.doubleValue() == 0) { // if (feedbackQuantitySubtract.doubleValue() == 0) {
// return 1; // return 1;
// } // }
...@@ -796,7 +795,7 @@ public class ProFeedbackServiceImpl implements IProFeedbackService { ...@@ -796,7 +795,7 @@ public class ProFeedbackServiceImpl implements IProFeedbackService {
proTaskService.updateProTask(thisProTask); proTaskService.updateProTask(thisProTask);
proTaskService.updateProTask(nextProTask); proTaskService.updateProTask(nextProTask);
if (thisTaskWait.compareTo(BigDecimal.ZERO) > 0 && !proTaskWorkunit.getStatus().equals(TaskWorkunitStatusEnum.BEGINNING.getStatus())) { if (thisTaskWait.compareTo(BigDecimal.ZERO) > 0 && proTaskWorkunit.getStatus().equals(TaskWorkunitStatusEnum.FINISHED.getStatus())) {
proTaskWorkunit.setStatus(TaskWorkunitStatusEnum.BEGINNING.getStatus()); proTaskWorkunit.setStatus(TaskWorkunitStatusEnum.BEGINNING.getStatus());
thisProTask.setTaskWorkunitId(proTaskWorkunit.getTaskWorkunitId()); thisProTask.setTaskWorkunitId(proTaskWorkunit.getTaskWorkunitId());
thisProTask.setWorkunitId(proTaskWorkunit.getWorkunitId()); thisProTask.setWorkunitId(proTaskWorkunit.getWorkunitId());
......
...@@ -795,18 +795,15 @@ public class ProTaskServiceImpl implements IProTaskService { ...@@ -795,18 +795,15 @@ public class ProTaskServiceImpl implements IProTaskService {
ProTask task = this.selectProTaskByTaskId(feedback.getTaskId()); ProTask task = this.selectProTaskByTaskId(feedback.getTaskId());
BigDecimal taskQuantityWaitConst = task.getQuantityWait(); BigDecimal taskQuantityWaitConst = task.getQuantityWait();
double taskQuantityWaitDouConst = taskQuantityWaitConst.doubleValue();
double feedbackQualityDouConst = feedbackQualifyConst.doubleValue(); double feedbackQualityDouConst = feedbackQualifyConst.doubleValue();
BigDecimal quantityWaitVal = BigDecimal.ZERO; BigDecimal quantityWaitVal = BigDecimal.ZERO;
BigDecimal feedbackQualityVal = BigDecimal.valueOf(feedbackQualityDouConst); BigDecimal feedbackQualityVal = BigDecimal.valueOf(feedbackQualityDouConst);
Long workorderId = feedback.getWorkorderId();
QueryWrapper<ProWorkorder> queryWrapper = new QueryWrapper<>(); QueryWrapper<ProWorkorder> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("t1.workorder_code", task.getArrangeCode()); queryWrapper.eq("t1.workorder_code", task.getArrangeCode());
queryWrapper.notIn("t1.status", Arrays.asList(WorkorderStatusEnum.CLOSE.getValue(), WorkorderStatusEnum.CANCEL.getValue(), WorkorderStatusEnum.CANCELED.getValue())); queryWrapper.notIn("t1.status", Arrays.asList(WorkorderStatusEnum.CLOSE.getValue(), WorkorderStatusEnum.CANCEL.getValue(), WorkorderStatusEnum.CANCELED.getValue()));
List<ProWorkorder> proWorkorders = proWorkorderService.selectListByQw(queryWrapper); List<ProWorkorder> proWorkorders = proWorkorderService.selectListByQw(queryWrapper);
double maxWorkunitQuantityConst = taskWorkunit.getQuantity().doubleValue();
//检查该工单绑定的生产版本是否允许超报,PS只有首工序允许 //检查该工单绑定的生产版本是否允许超报,PS只有首工序允许
if(taskQuantityWaitConst.compareTo(feedbackQualifyConst.add(fuantityUnqualify)) < 0){ if(taskQuantityWaitConst.compareTo(feedbackQualifyConst.add(fuantityUnqualify)) < 0){
if(task.getOrdinal() == 1){ if(task.getOrdinal() == 1){
......
...@@ -579,31 +579,29 @@ public class ProTaskWorkunitServiceImpl implements IProTaskWorkunitService { ...@@ -579,31 +579,29 @@ public class ProTaskWorkunitServiceImpl implements IProTaskWorkunitService {
List<ProTask> taskBatchTasks = proTaskMapper.selectByTaskBatch(taskBatch); List<ProTask> taskBatchTasks = proTaskMapper.selectByTaskBatch(taskBatch);
if(taskBatchTasks.size() > 0){ if(taskBatchTasks.size() > 0){
List<TaskProPrintData> taskProPrintDatas = new ArrayList<>();
Map<String,Object> value = new HashMap<>(); Map<String,Object> value = new HashMap<>();
valueList.add( value); valueList.add( value);
ProWorkorder proWorkorder = proWorkorderMapper.selectProWorkorderWorderCode(taskBatchTasks.get(0).getArrangeCode()); ProWorkorder proWorkorder = proWorkorderMapper.selectProWorkorderWorderCode(taskBatchTasks.get(0).getArrangeCode());
TaskProWorkorderPrintData taskProWorkorderPrintData = new TaskProWorkorderPrintData(); TaskProWorkorderPrintData taskProWorkorderPrintData = new TaskProWorkorderPrintData();
BeanUtil.copyProperties(proWorkorder,taskProWorkorderPrintData); BeanUtil.copyProperties(proWorkorder,taskProWorkorderPrintData);
value.put("header",taskProWorkorderPrintData); value.put("header",taskProWorkorderPrintData);
value.put("detail",taskBatchTasks); value.put("detail",taskProPrintDatas);
if(taskProWorkorderPrintData.getExpectStartDate() != null || taskProWorkorderPrintData.getRequestDate() != null){ if(taskProWorkorderPrintData.getExpectStartDate() != null || taskProWorkorderPrintData.getRequestDate() != null){
for (ProTask proTask : taskBatchTasks){ for (ProTask proTask : taskBatchTasks){
TaskProPrintData taskProPrintData = new TaskProPrintData();
BeanUtil.copyProperties(proTask,taskProPrintData);
String begin = taskProWorkorderPrintData.getExpectStartDate() != null ? simpleDateFormat1.format(taskProWorkorderPrintData.getExpectStartDate()) : "空"; String begin = taskProWorkorderPrintData.getExpectStartDate() != null ? simpleDateFormat1.format(taskProWorkorderPrintData.getExpectStartDate()) : "空";
String end = taskProWorkorderPrintData.getRequestDate() != null ? simpleDateFormat1.format(taskProWorkorderPrintData.getRequestDate()) : "空"; String end = taskProWorkorderPrintData.getRequestDate() != null ? simpleDateFormat1.format(taskProWorkorderPrintData.getRequestDate()) : "空";
proTask.setExpectStartDateString(begin); taskProPrintData.setExpectStartDateString(begin);
proTask.setRequestDateString(end); taskProPrintData.setRequestDateString(end);
taskProPrintDatas.add(taskProPrintData);
} }
} }
taskProWorkorderPrintData.setSize(i++); taskProWorkorderPrintData.setSize(i++);
taskProWorkorderPrintData.setDate(simpleDateFormat.format(new Date())); taskProWorkorderPrintData.setDate(simpleDateFormat.format(new Date()));
taskProWorkorderPrintData.setQuantity(taskBatchTasks.get(0).getQuantity()); taskProWorkorderPrintData.setQuantity(taskBatchTasks.get(0).getQuantity());
// if(proWorkorder.getOrderCode() != null && proWorkorder.getProductId() != null){
// OdSalesOrderDetail odSalesOrderDetail = odSalesOrderDetailMapper.getByOrderCodeAndproductId(proWorkorder.getOrderCode(),proWorkorder.getProductId());
// if(odSalesOrderDetail != null){
// taskProWorkorderPrintData.setClientItemNo(odSalesOrderDetail.getClientItemNo());
// taskProWorkorderPrintData.setPoOrderNo(odSalesOrderDetail.getPoOrderNo());
// }
// }
} }
} }
return printData; return printData;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment