| | |
| | | import com.zy.common.web.BaseController; |
| | | |
| | | import org.apache.poi.xssf.usermodel.*; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | |
| | | @RestController |
| | | public class SaleOrderController extends BaseController { |
| | | |
| | | private static final Logger logger = LoggerFactory.getLogger(SaleOrderController.class); |
| | | |
| | | @Autowired |
| | | private SaleOrderService saleOrderService; |
| | |
| | | String invCode = data.get("invCode") != null ? String.valueOf(data.get("invCode")).trim() : null; |
| | | String orderCode = data.get("orderCode") != null ? String.valueOf(data.get("orderCode")).trim() : null; |
| | | if (Cools.isEmpty(invCode) || Cools.isEmpty(orderCode)) { |
| | | logger.debug("cust_wait_pakin 跳过更新:订单号或物料编码为空,orderCode={},invCode={}", orderCode, invCode); |
| | | return; |
| | | } |
| | | Double productQty = parseDoubleSafely(data.get("productQty")); |
| | | if (productQty == null) { |
| | | productQty = parseDoubleSafely(data.get("orderQty")); |
| | | } |
| | | logger.info("cust_wait_pakin 开始更新:订单号={},物料编码={},数量={}", orderCode, invCode, productQty); |
| | | String invName = data.get("invName") != null ? String.valueOf(data.get("invName")) : null; |
| | | WaitPakin updateEntity = new WaitPakin(); |
| | | updateEntity.setMaktx(invName); |
| | |
| | | updateEntity.setNqty(productQty); |
| | | updateEntity.setModiTime(new Date()); |
| | | Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>().eq("matnr", invCode).eq("mnemonic", orderCode); |
| | | waitPakinService.update(updateEntity, wrapper); |
| | | boolean updated = waitPakinService.update(updateEntity, wrapper); |
| | | if (updated) { |
| | | logger.info("cust_wait_pakin 更新成功:订单号={},物料编码={},数量={}", orderCode, invCode, productQty); |
| | | } else { |
| | | logger.warn("cust_wait_pakin 更新未影响行(可能无匹配记录):订单号={},物料编码={}", orderCode, invCode); |
| | | } |
| | | } catch (Exception e) { |
| | | // 不抛异常,避免影响销售订单保存 |
| | | logger.error("cust_wait_pakin 更新异常:orderCode={},invCode={},error={}", data.get("orderCode"), data.get("invCode"), e.getMessage(), e); |
| | | } |
| | | } |
| | | |