|
@@ -19,8 +19,10 @@ import nc.bs.framework.adaptor.IHttpServletAdaptor;
|
|
|
import nc.bs.framework.common.InvocationInfoProxy;
|
|
|
import nc.bs.framework.common.NCLocator;
|
|
|
import nc.itf.uap.IVOPersistence;
|
|
|
+import nc.itf.uap.bd.def.IDefdoc;
|
|
|
import nc.itf.uap.bd.inv.IInventoryAssign;
|
|
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
|
|
+import nc.vo.bd.def.DefdocVO;
|
|
|
import nc.vo.bd.invdoc.InvbasdocVO;
|
|
|
import nc.vo.bd.invdoc.InvmandocVO;
|
|
|
import nc.vo.pub.BusinessException;
|
|
@@ -41,12 +43,29 @@ public class InvAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
IVOPersistence ivo = NCLocator.getInstance().lookup(IVOPersistence.class);
|
|
|
IInventoryAssign iassign = NCLocator.getInstance().lookup(IInventoryAssign.class);
|
|
|
UserTransaction trans;
|
|
|
+ String color = "";//颜色
|
|
|
+ String colordeflist = "";//颜色对应自定义档案列表主键
|
|
|
+ String alloy = "";//合金
|
|
|
+ String alloydeflist = "";//合金对应自定义档案列表主键
|
|
|
+ String sizing = "";//定尺
|
|
|
+ String sizingdeflist = "";//定尺对应自定义档案列表主键
|
|
|
+ String standard = "";//标准
|
|
|
+ String standarddeflist = "";//标准对应自定义档案列表主键
|
|
|
+ IDefdoc idef = NCLocator.getInstance().lookup(IDefdoc.class);
|
|
|
|
|
|
@Override
|
|
|
public void doAction(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
|
|
try {
|
|
|
trans = NCLocator.getInstance().lookup(UserTransaction.class);
|
|
|
trans.begin();//开启事务
|
|
|
+ color = GetBaseDAOUtil.getdefdef("YS(颜色)").getPk_defdef();
|
|
|
+ colordeflist = GetBaseDAOUtil.getdefdef("YS(颜色)").getPk_defdoclist();
|
|
|
+ alloy = GetBaseDAOUtil.getdefdef("HI(合金)").getPk_defdef();
|
|
|
+ alloydeflist = GetBaseDAOUtil.getdefdef("HI(合金)").getPk_defdoclist();
|
|
|
+ sizing = GetBaseDAOUtil.getdefdef("DC(定尺)").getPk_defdef();
|
|
|
+ sizingdeflist = GetBaseDAOUtil.getdefdef("DC(定尺)").getPk_defdoclist();
|
|
|
+ standard = GetBaseDAOUtil.getdefdef("BZ(标准)").getPk_defdef();
|
|
|
+ standarddeflist = GetBaseDAOUtil.getdefdef("BZ(标准)").getPk_defdoclist();
|
|
|
String createStr = buildJson(req, resp, this.getClass().getName());
|
|
|
JSONObject json = JSON.parseObject(createStr);
|
|
|
//接口返回结果
|
|
@@ -102,7 +121,7 @@ public class InvAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
//存货分类
|
|
|
String invCl = GetBaseDAOUtil.getInvClid(bodyObject.getString("invCl"));
|
|
|
//主计量单位
|
|
|
- String invMeas = GetBaseDAOUtil.getMeasid(bodyObject.getString("invMeas"));
|
|
|
+ String invMeas = GetBaseDAOUtil.getMeasidByName(bodyObject.getString("invMeas"));
|
|
|
//税目
|
|
|
String invTaxitems = GetBaseDAOUtil.gettaxitemid(bodyObject.getString("invTaxitems"));
|
|
|
//图号
|
|
@@ -115,6 +134,43 @@ public class InvAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
String width = bodyObject.getString("width");
|
|
|
//备注
|
|
|
String memo = bodyObject.getString("memo");
|
|
|
+ //批次管理
|
|
|
+ String wholemanaflag = bodyObject.getString("wholemanaflag");
|
|
|
+ //颜色
|
|
|
+ Object ys = bodyObject.getString("ys");
|
|
|
+ //合金
|
|
|
+ Object hj = bodyObject.getString("hj");
|
|
|
+ //定尺
|
|
|
+ Object dc = bodyObject.getString("dc");
|
|
|
+ //标准
|
|
|
+ Object bz = bodyObject.getString("bz");
|
|
|
+
|
|
|
+ if(!ys.equals("")&&ys != null) {
|
|
|
+ String yspk = GetBaseDAOUtil.getdefdocid(colordeflist, ys.toString());
|
|
|
+ if(yspk.equals("")) {
|
|
|
+ genDocVO(pk_corp, ys.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!hj.equals("")&&hj != null) {
|
|
|
+ String hjpk = GetBaseDAOUtil.getdefdocid(alloydeflist, hj.toString());
|
|
|
+ if(hjpk.equals("")) {
|
|
|
+ genDocVO(pk_corp, hj.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!dc.equals("")&&dc != null) {
|
|
|
+ String dcpk = GetBaseDAOUtil.getdefdocid(sizingdeflist, dc.toString());
|
|
|
+ if(dcpk.equals("")) {
|
|
|
+ genDocVO(pk_corp, dc.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!bz.equals("")&&bz != null) {
|
|
|
+ String bzpk = GetBaseDAOUtil.getdefdocid(standarddeflist, bz.toString());
|
|
|
+ if(bzpk.equals("")) {
|
|
|
+ genDocVO(pk_corp, bz.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
String pk_inv = "";
|
|
|
InvbasdocVO invbasVo = GetBaseDAOUtil.getInvVO(invCode);
|
|
|
if(invbasVo != null) {
|
|
@@ -134,6 +190,18 @@ public class InvAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
invbasVo.setMemo(memo);
|
|
|
invbasVo.setCreator("demo");
|
|
|
invbasVo.setSealflag(UFBoolean.FALSE);
|
|
|
+ if(!ys.equals("")) {
|
|
|
+ invbasVo.setFree1(color);
|
|
|
+ }
|
|
|
+ if(!hj.equals("")) {
|
|
|
+ invbasVo.setFree2(alloy);
|
|
|
+ }
|
|
|
+ if(!dc.equals("")) {
|
|
|
+ invbasVo.setFree3(sizing);
|
|
|
+ }
|
|
|
+ if(!bz.equals("")) {
|
|
|
+ invbasVo.setFree4(standard);
|
|
|
+ }
|
|
|
ivo.updateVO(invbasVo);
|
|
|
}
|
|
|
else {
|
|
@@ -171,12 +239,24 @@ public class InvAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
invbasVo.setDr(0);
|
|
|
invbasVo.setCreator("demo");
|
|
|
invbasVo.setSealflag(UFBoolean.FALSE);
|
|
|
+ if(!ys.equals("")) {
|
|
|
+ invbasVo.setFree1(color);
|
|
|
+ }
|
|
|
+ if(!hj.equals("")) {
|
|
|
+ invbasVo.setFree2(alloy);
|
|
|
+ }
|
|
|
+ if(!dc.equals("")) {
|
|
|
+ invbasVo.setFree3(sizing);
|
|
|
+ }
|
|
|
+ if(!bz.equals("")) {
|
|
|
+ invbasVo.setFree4(standard);
|
|
|
+ }
|
|
|
pk_inv = ivo.insertVO(invbasVo);
|
|
|
}
|
|
|
//查看当前存货是否有对应的存货管理档案
|
|
|
String pk_invman = IsExist(pk_inv);
|
|
|
if(pk_invman.equals("")) {
|
|
|
- pk_invman = saveInvman(invbasVo,pk_inv);
|
|
|
+ pk_invman = saveInvman(invbasVo,pk_inv,wholemanaflag);
|
|
|
}
|
|
|
|
|
|
List<String> listpk = new ArrayList<String>();
|
|
@@ -216,6 +296,17 @@ public class InvAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //生成自定义档案
|
|
|
+ private void genDocVO(String pk_corp, String docname) throws BusinessException {
|
|
|
+ DefdocVO docvo = new DefdocVO();
|
|
|
+ docvo.setDoccode(docname);
|
|
|
+ docvo.setDocname(docname);
|
|
|
+ docvo.setDocsystype(1);
|
|
|
+ docvo.setPk_corp(pk_corp);
|
|
|
+ docvo.setPk_defdoclist(colordeflist);
|
|
|
+ String respk = idef.insert(docvo);
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
* 非空判断
|
|
|
*/
|
|
@@ -239,10 +330,11 @@ public class InvAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
String invCl = "invCl";//存货分类
|
|
|
String invMeas = "invMeas";//主计量单位
|
|
|
String invTaxitems = "invTaxitems";//税目
|
|
|
+ String wholemanaflag = "wholemanaflag";
|
|
|
|
|
|
for(int i = 0; i < oprepObjectBs.size(); i++) {
|
|
|
JSONObject oprepJsonObjectB = oprepObjectBs.getJSONObject(i);
|
|
|
- String[] HeadKey = {pk_corp,invCode,invName,invCl,invMeas,invTaxitems};
|
|
|
+ String[] HeadKey = {pk_corp,invCode,invName,invCl,invMeas,invTaxitems,wholemanaflag};
|
|
|
int num = i+1;
|
|
|
|
|
|
mags.append("第"+num+"块:{");
|
|
@@ -282,7 +374,7 @@ public class InvAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
* @return
|
|
|
* @throws BusinessException
|
|
|
*/
|
|
|
- private String saveInvman(InvbasdocVO invbasVo, String pk_inv) throws BusinessException {
|
|
|
+ private String saveInvman(InvbasdocVO invbasVo, String pk_inv,String wholemanaflag) throws BusinessException {
|
|
|
InvmandocVO invmanVO = new InvmandocVO();
|
|
|
|
|
|
invmanVO.setPk_invbasdoc(pk_inv);
|
|
@@ -332,7 +424,12 @@ public class InvAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
invmanVO.setConsumesettleflag(UFBoolean.FALSE);
|
|
|
invmanVO.setCreatetime(new UFDateTime());
|
|
|
invmanVO.setCreator("demo");
|
|
|
-
|
|
|
+ if(wholemanaflag.equals("Y")) {
|
|
|
+ invmanVO.setWholemanaflag(UFBoolean.TRUE);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ invmanVO.setWholemanaflag(UFBoolean.FALSE);
|
|
|
+ }
|
|
|
//保存管理档案
|
|
|
String pk_invman = dao.insertVO(invmanVO);
|
|
|
|