|  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.zy.asrs.common.openapi.entity.HostKey; | 
 |  |  | import com.zy.asrs.common.openapi.entity.dto.OrderListDto; | 
 |  |  | import com.zy.asrs.common.openapi.entity.param.CreateMatParam; | 
 |  |  | import com.zy.asrs.common.openapi.entity.param.GenerateOrderPakInParam; | 
 |  |  | import com.zy.asrs.common.openapi.entity.param.GenerateOrderPakOutParam; | 
 |  |  | import com.zy.asrs.common.openapi.entity.param.OrderListParam; | 
 |  |  | import com.zy.asrs.common.openapi.service.ApiService; | 
 |  |  | import com.zy.asrs.common.openapi.service.HostKeyService; | 
 |  |  | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | import javax.servlet.http.HttpServletRequest; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  |  | 
 |  |  | 
 |  |  |     private HostKeyService hostKeyService; | 
 |  |  |     @Autowired | 
 |  |  |     private ApiService apiService; | 
 |  |  |  | 
 |  |  |     @PostMapping("/test") | 
 |  |  |     public R test() { | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 生成入库订单 | 
 |  |  | 
 |  |  |         if (Cools.isEmpty(param.getOrderType())) { | 
 |  |  |             return R.error("单据类型[orderType]不能为空"); | 
 |  |  |         } | 
 |  |  |         if (Cools.isEmpty(param.getOrderDetails())) { | 
 |  |  |             return R.error("单据明细[orderDetails]不能为空"); | 
 |  |  |         if (Cools.isEmpty(param.getMats())) { | 
 |  |  |             return R.error("物料[mats]不能为空"); | 
 |  |  |         } | 
 |  |  |         param.setHostId(hostKey.getHostId()); | 
 |  |  |         apiService.generateOrderPakIn(param); | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 生成出库订单 | 
 |  |  |      */ | 
 |  |  |     @PostMapping("generateOrderPakOut") | 
 |  |  |     @AppAuth(memo = "生成出库订单") | 
 |  |  |     public synchronized R generateOrderPakOut(@RequestHeader(required = false) String appkey, | 
 |  |  |                                             @RequestBody GenerateOrderPakOutParam param) { | 
 |  |  |         HostKey hostKey = auth(appkey, param, true); | 
 |  |  |         if (Cools.isEmpty(param)) { | 
 |  |  |             return R.parse(BaseRes.PARAM); | 
 |  |  |         } | 
 |  |  |         if (Cools.isEmpty(param.getOrderNo())) { | 
 |  |  |             return R.error("单据编号[orderNo]不能为空"); | 
 |  |  |         } | 
 |  |  |         if (Cools.isEmpty(param.getOrderType())) { | 
 |  |  |             return R.error("单据类型[orderType]不能为空"); | 
 |  |  |         } | 
 |  |  |         if (Cools.isEmpty(param.getMats())) { | 
 |  |  |             return R.error("物料[mats]不能为空"); | 
 |  |  |         } | 
 |  |  |         param.setHostId(hostKey.getHostId()); | 
 |  |  |         apiService.generateOrderPakOut(param); | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |         return R.ok().add(orderList); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 创建物料信息 | 
 |  |  |      */ | 
 |  |  |     @PostMapping("/createMat") | 
 |  |  |     public synchronized R createMat(@RequestHeader(required = true) String appkey, | 
 |  |  |                                     @RequestBody(required = false) CreateMatParam param) { | 
 |  |  |         HostKey hostKey = auth(appkey, param, true); | 
 |  |  |         param.setHostId(hostKey.getHostId()); | 
 |  |  |         int result = apiService.createMat(param); | 
 |  |  |         return R.ok().add(result); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private HostKey auth(String appkey, Object obj, boolean signCheck) { | 
 |  |  |         request.setAttribute("cache", obj); | 
 |  |  |         if (Cools.isEmpty(appkey)) { |