loujf 3 years ago
parent
commit
1835d2fea2
  1. 20
      nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java
  2. 20
      nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java
  3. 2
      nladmin-system/src/main/java/org/nl/acs/order/service/dto/ProduceshiftorderdetailDto.java
  4. 169
      nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java
  5. BIN
      nladmin-system/src/main/java/org/nl/acs/order/service/wql/order.xls

20
nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java

@ -70,8 +70,8 @@ public class ProduceshiftorderController {
@Log("修改工单")
@ApiOperation("修改工单")
//@PreAuthorize("@el.check('produceshiftorder:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody ProduceshiftorderDto dto) {
produceshiftorderService.update(dto);
public ResponseEntity<Object> update(@Validated @RequestBody Map whereJson) {
produceshiftorderService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@ -100,6 +100,22 @@ public class ProduceshiftorderController {
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("急停")
@ApiOperation("急停")
@PostMapping(value = "/stop")
public ResponseEntity<Object> stop() {
produceshiftorderService.stop();
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("设备恢复")
@ApiOperation("设备恢复")
@PostMapping(value = "/device_restore")
public ResponseEntity<Object> device_restore() {
produceshiftorderService.device_restore();
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("清料")
@ApiOperation("清料")
@PostMapping(value = "/clear")

20
nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java

@ -95,6 +95,13 @@ public interface ProduceshiftorderService {
void update(ProduceshiftorderDto dto);
/**
* 编辑
*
* @param whereJson /
*/
void update(Map whereJson);
/**
* 多选删除
*
@ -116,6 +123,19 @@ public interface ProduceshiftorderService {
*/
void device_pause();
/**
* 设备恢复
*
*/
void device_restore();
/**
* 急停
*
*/
void stop();
/**
* 清料

2
nladmin-system/src/main/java/org/nl/acs/order/service/dto/ProduceshiftorderdetailDto.java

@ -58,7 +58,7 @@ public class ProduceshiftorderdetailDto implements Serializable {
private String lettering_message;
/** 刻字图标类型 */
private String lettering_icon_type;
private String lettering_icon;
/** 图标后刻字信息 */
private String lettering_message2;

169
nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java

@ -97,6 +97,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
new_jo.put("cust_code", orderDteail_jo.getString("cust_code"));
new_jo.put("cust_name", orderDteail_jo.getString("cust_name"));
new_jo.put("qty", orderDteail_jo.getString("order_detail_qty"));
new_jo.put("lettering_icon_type", orderDteail_jo.getString("lettering_icon"));
new_jo.put("lettering_message", orderDteail_jo.getString("lettering_message"));
new_jo.put("lettering_message2", orderDteail_jo.getString("lettering_message2"));
new_jo.put("type", "orderDteail");
new_jo.put("is_flag", "0");
children.add(new_jo);
@ -152,6 +155,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
new_jo.put("cust_code", orderDteail_jo.getString("cust_code"));
new_jo.put("cust_name", orderDteail_jo.getString("cust_name"));
new_jo.put("qty", orderDteail_jo.getString("order_detail_qty"));
new_jo.put("lettering_icon_type", orderDteail_jo.getString("lettering_icon_type"));
new_jo.put("lettering_message", orderDteail_jo.getString("lettering_message"));
new_jo.put("lettering_message2", orderDteail_jo.getString("lettering_message2"));
new_jo.put("type", "orderDteail");
new_jo.put("is_flag", "0");
children.add(new_jo);
@ -308,6 +314,132 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
}
}
@Override
public void update(Map whereJson) {
JSONObject param=new JSONObject(whereJson);
String currentUsername = SecurityUtils.getCurrentUsername();
ProduceshiftorderDto orderDto = new ProduceshiftorderDto();
String order_id = MapUtil.getStr(whereJson, "order_id");
String order_code = MapUtil.getStr(whereJson, "order_code");
String material_id = MapUtil.getStr(whereJson, "material_id");
String material_code = MapUtil.getStr(whereJson, "material_code");
String material_name = MapUtil.getStr(whereJson, "material_name");
String material_spec = MapUtil.getStr(whereJson, "material_spec");
String outer_diameter = MapUtil.getStr(whereJson, "outer_diameter");
String wall_thickness = MapUtil.getStr(whereJson, "wall_thickness");
String length = MapUtil.getStr(whereJson, "length");
String qty = MapUtil.getStr(whereJson, "qty");
if(StrUtil.isEmpty(material_code)){
throw new RuntimeException("物料编号不可为空!");
}
JSONArray tableData = param.getJSONArray("tableData");
if (ObjectUtil.isEmpty(tableData)){
throw new BadRequestException("客户信息不可为空!");
}
ProduceshiftorderDto entity = this.findById(order_id);
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
orderDto.setMaterial_code(material_code);
orderDto.setMaterial_name(material_name);
orderDto.setMaterial_spec(material_spec);
orderDto.setMaterial_uuid(material_id);
orderDto.setLength(length);
orderDto.setOuter_diameter(outer_diameter);
orderDto.setWall_thickness(wall_thickness);
orderDto.setOrder_code(order_code);
orderDto.setQty(qty);
orderDto.setCreate_by(currentUsername);
orderDto.setIs_coating("1");
orderDto.setIs_labeling("1");
orderDto.setIs_lettering("1");
orderDto.setIs_risking("1");
orderDto.setIs_strapping("1");
orderDto.setIs_unbundling("1");
for(int i=0; i<tableData.size(); i++){
JSONObject jsonObject = tableData.getJSONObject(i);
String order_detail_id = jsonObject.getString("order_detail_id");
//客户标识
String customer_id = jsonObject.getString("cust_id");
//客户编码
String customer_code = jsonObject.getString("cust_code");
//客户名称
String customer_name = jsonObject.getString("cust_name");
//明细号客户数量
String detail_qty = jsonObject.getString("order_detail_qty");
//图标前刻字信息
String lettering_message = jsonObject.getString("lettering_message");
//图标前刻字信息
String lettering_message2 = jsonObject.getString("lettering_message2");
//图标类型
String lettering_icon = jsonObject.getString("lettering_icon");
//捆扎每包数量
String strap_number = jsonObject.getString("strap_number");
//尾料数量
String strap_tailint_number = String.valueOf(Integer.parseInt(detail_qty)%Integer.parseInt(strap_number));
ProduceshiftorderdetailDto detaildto = produceshiftorderdetailService.findById(order_detail_id);
if(!ObjectUtil.isEmpty(detaildto)){
detaildto.setOrder_id(order_id);
detaildto.setOrder_code(order_code);
detaildto.setOrder_detail_status("00");
detaildto.setOrder_qty(qty);
detaildto.setIs_deleted("0");
detaildto.setOrder_detail_code(String.valueOf(i+1));
detaildto.setCust_id(customer_id);
detaildto.setCust_code(customer_code);
detaildto.setCust_name(customer_name);
detaildto.setMaterial_code(material_code);
detaildto.setMaterial_id(material_id);
detaildto.setMaterial_name(material_name);
detaildto.setLength(length);
detaildto.setWall_thickness(wall_thickness);
detaildto.setOuter_diameter(outer_diameter);
detaildto.setLabeling_message(lettering_message);
detaildto.setStrap_number(strap_number);
detaildto.setStrap_tailint_number(strap_tailint_number);
detaildto.setLettering_icon(lettering_icon);
detaildto.setLettering_message(lettering_message);
detaildto.setLettering_message2(lettering_message2);
produceshiftorderdetailService.update(detaildto);
// WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorderdetail");
// JSONObject json= (JSONObject) JSONObject.toJSON(detaildto);
// wo.update(json);
} else {
detaildto = new ProduceshiftorderdetailDto();
detaildto.setOrder_id(order_id);
detaildto.setOrder_code(order_code);
detaildto.setOrder_detail_status("00");
detaildto.setOrder_qty(qty);
detaildto.setIs_deleted("0");
detaildto.setOrder_detail_id(IdUtil.simpleUUID());
detaildto.setOrder_detail_code(String.valueOf(i+1));
detaildto.setCust_id(customer_id);
detaildto.setCust_code(customer_code);
detaildto.setCust_name(customer_name);
detaildto.setMaterial_code(material_code);
detaildto.setMaterial_id(material_id);
detaildto.setMaterial_name(material_name);
detaildto.setLength(length);
detaildto.setWall_thickness(wall_thickness);
detaildto.setOuter_diameter(outer_diameter);
detaildto.setLabeling_message(lettering_message);
detaildto.setStrap_number(strap_number);
detaildto.setStrap_tailint_number(strap_tailint_number);
produceshiftorderdetailService.create(detaildto);
// WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorderdetail");
// JSONObject json = (JSONObject) JSONObject.toJSON(detaildto);
// wo.insert(json);
}
}
}
@Override
public void deleteAll(String[] ids) {
for (String id : ids) {
@ -374,6 +506,39 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
}
}
@Override
public void device_restore() {
HaiLiangFeedingTrunkDeviceDriver haiLiangFeedingTrunkDeviceDriver;
List<HaiLiangFeedingTrunkDeviceDriver> deviceAll = deviceAppService.findDeviceDriver(HaiLiangFeedingTrunkDeviceDriver.class);
if (deviceAll.get(0) instanceof HaiLiangFeedingTrunkDeviceDriver) {
haiLiangFeedingTrunkDeviceDriver = (HaiLiangFeedingTrunkDeviceDriver) deviceAll.get(0);
if(haiLiangFeedingTrunkDeviceDriver.getMode() !=2){
throw new BadRequestException("设备未联机,无法下发恢复!");
}
if(haiLiangFeedingTrunkDeviceDriver.getPause() == 0 ){
throw new BadRequestException("设备已处于恢复状态,无法下发恢复!");
}
haiLiangFeedingTrunkDeviceDriver.writing("item_to_pause","0");
}
}
@Override
public void stop() {
HaiLiangFeedingTrunkDeviceDriver haiLiangFeedingTrunkDeviceDriver;
List<HaiLiangFeedingTrunkDeviceDriver> deviceAll = deviceAppService.findDeviceDriver(HaiLiangFeedingTrunkDeviceDriver.class);
if (deviceAll.get(0) instanceof HaiLiangFeedingTrunkDeviceDriver) {
haiLiangFeedingTrunkDeviceDriver = (HaiLiangFeedingTrunkDeviceDriver) deviceAll.get(0);
if(haiLiangFeedingTrunkDeviceDriver.getMode() !=2){
throw new BadRequestException("设备未联机,无法下发恢复!");
}
if(haiLiangFeedingTrunkDeviceDriver.getPause() == 0 ){
throw new BadRequestException("设备已处于恢复状态,无法下发恢复!");
}
haiLiangFeedingTrunkDeviceDriver.writing("item_to_pause","0");
}
}
@Override
public void clear() {
HaiLiangFeedingTrunkDeviceDriver haiLiangFeedingTrunkDeviceDriver;
@ -399,8 +564,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
if(haiLiangFeedingTrunkDeviceDriver.getMode() !=2){
throw new BadRequestException("设备未联机,无法下发暂停!");
}
if(haiLiangFeedingTrunkDeviceDriver.getPause() == 0 ){
throw new BadRequestException("设备已处于恢复状态,无法下发恢复!");
if(haiLiangFeedingTrunkDeviceDriver.getPause() != 0 ){
throw new BadRequestException("设备已处于暂停状态,无法下发暂停!");
}
haiLiangFeedingTrunkDeviceDriver.writing("item_to_pause","0");
}

BIN
nladmin-system/src/main/java/org/nl/acs/order/service/wql/order.xls

Binary file not shown.
Loading…
Cancel
Save