This commit is contained in:
linfso 2024-11-28 11:31:38 +08:00
parent 6314ab8faf
commit 1208a28151
2 changed files with 12 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.xdadan.erp.oms.common.annotation.filter.jackson.JacksonFilter; import com.xdadan.erp.oms.common.annotation.filter.jackson.JacksonFilter;
import com.xdadan.erp.oms.utils.WaybillHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -199,6 +200,7 @@ public class Oms2cGoodsController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody EmisGoods emisGoods) public AjaxResult add(@RequestBody EmisGoods emisGoods)
{ {
emisGoods.setGoodsCode(WaybillHelper.genGoodsCode());
emisGoods.setOwnerCode(getLoginUser().getUser().getCustomerCode()); emisGoods.setOwnerCode(getLoginUser().getUser().getCustomerCode());
return toAjax(emisGoodsService.insertEmisGoods(emisGoods)); return toAjax(emisGoodsService.insertEmisGoods(emisGoods));
} }

View File

@ -39,6 +39,16 @@ public class WaybillHelper {
} }
/**
* 商品号生成逻辑,雪花算法
* @return
*/
public static String genGoodsCode(){
Snowflake snowflake = IdUtil.getSnowflake(0, 0);
Long goodsCode = snowflake.nextId();
return goodsCode.toString();
}