关键词:
我感觉有必要分享一下,历时2周搁置的功能
应该有很多小伙伴都在找的问题 祝你们好运
关键代码
集团id一定要填 , 两周的时间就是栽在这id上
try
BaseDAO bd = new BaseDAO();
nc.vo.so.m4331.entity.DeliveryHVO deliveryHVO=new nc.vo.so.m4331.entity.DeliveryHVO();
//fstatusflag //1=自由,2=审批通过,3=冻结,4=关闭,7=审批中,8=审批不通过,5=失效,
//获取销售发货单(4331) 进行审批 产生 销售出库单 (4C)
deliveryHVO = (nc.vo.so.m4331.entity.DeliveryHVO) bd.executeQuery("select * from jpncdb1.so_delivery where dr=0 and vbillcode ='"+vsourcebillcode2+"'", new BeanProcessor(nc.vo.so.m4331.entity.DeliveryHVO.class));
if (deliveryHVO != null)
String so_delivery_pk=deliveryHVO.getAttributeValue("cdeliveryid").toString();//主键
SuperVO[] deliveryBVO = HYPubBO_Client.queryByCondition(DeliveryBVO.class, " cdeliveryid = '"+so_delivery_pk+"'");
// 30 4331 4C
//String flag2 = PfUtilTools.approveSilently("4331",so_delivery_pk, "Y", "批准","hcj",null);
IplatFormEntry iIplatFormEntry = (IplatFormEntry) NCLocator.getInstance().lookup(IplatFormEntry.class.getName());
//这是集团ID 一般每个表都有 随便找 pk_group 字段
InvocationInfoProxy.getInstance().setGroupId("00013910000000000N4S"); //这个字段很重要
AggregatedValueObject deliveryVO= new nc.vo.so.m4331.entity.DeliveryVO();
deliveryVO.setParentVO(deliveryHVO);
deliveryVO.setChildrenVO(deliveryBVO);
HashMap map = new HashMap();
map.put("notechecked", "notechecked");
// 审批动作 ,审批单据类型 , null ,billvo,null, 环境 ,
Object processAction = iIplatFormEntry.processAction("APPROVE", "4331", null, deliveryVO,null, map);
catch (Exception e1)
e1.printStackTrace();
package nc.impl.jpncinterface;
import java.awt.event.ActionEvent;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Pattern;
import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.framework.common.NCLocator;
import nc.bs.ic.general.businessevent.ICGeneralCommonEvent;
import nc.bs.pub.pf.PfUtilTools;
import nc.impl.pubapp.pattern.data.bill.BillQuery;
import nc.itf.uap.pf.IPFBusiAction;
import nc.itf.uap.pf.IplatFormEntry;
import nc.jdbc.framework.processor.BeanListProcessor;
import nc.jdbc.framework.processor.BeanProcessor;
import nc.jdbc.framework.processor.ColumnProcessor;
import nc.md.persist.framework.IMDPersistenceQueryService;
import nc.ui.so.m30.billui.action.SaleOrderMESApproveAction;
import nc.ui.so.m4331.billui.action.DeliveryApproveAction;
import nc.ui.trade.business.HYPubBO_Client;
import nc.vo.ic.m4c.entity.SaleOutBodyVO;
import nc.vo.ic.m4c.entity.SaleOutHeadVO;
import nc.vo.pu.m21.entity.OrderItemVO;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.SuperVO;
import nc.vo.pub.pf.workflow.IPFActionName;
import nc.vo.rmex.rmupload.deliverybill.DeliveryBillHVO;
import nc.vo.so.m4331.entity.DeliveryBVO;
import nc.vo.so.m4331.entity.DeliveryVO;
import org.apache.commons.lang3.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
public class GetIcSaleout
//库存销售出库单
public String getExecute(String operation,String orderform)
String resultstr=null;
if (operation.equals("Insert"))
//插入
if(isJsonObject(orderform))//验证入参
resultstr = insert(operation, orderform);
else
JSONObject backinfojson=new JSONObject();
backinfojson.put("$successful", "N");
backinfojson.put("sendresult", "JSON格式错误");
resultstr=backinfojson.toString();
else if (operation.equals("Update"))
//修改
resultstr=update(operation, orderform);
else if (operation.equals("Delete"))
//删除
resultstr=delete(operation, orderform);
else if (operation.equals("Search"))
//查询
resultstr = search(operation, orderform);
else
JSONObject backinfojson=new JSONObject();
backinfojson.put("$successful", "N");
backinfojson.put("sendresult", "未开放!");
resultstr=backinfojson.toString();
return resultstr;
/**
* 插入
* @param operation
* @param orderform
* @return
*/
public String insert(String operation,String orderform)
JSONObject orderjson = JSON.parseObject(orderform);
StringBuffer xml_sb=new StringBuffer();
//String vbillcode = orderjson.getString("vbillcode");//单
String vsourcebillcode2 = orderjson.getString("vsourcebillcode");//销售发货单号
/*
* -- 订单类型
select * from jpncdb1.bd_billtype where billtypename like '%整车销售%' and parentbilltype = '4C'
-- 销售发货单 单据号审批 产生销售出库单
* */
//String flag1 = PfUtilTools.approveSilently("交易类型编码或单据类型",主表主键, "是否通过", 审批批语, "",用户组, "动作");
try
BaseDAO bd = new BaseDAO();
nc.vo.so.m4331.entity.DeliveryHVO deliveryHVO=new nc.vo.so.m4331.entity.DeliveryHVO();
//nc.vo.so.m4331.entity.DeliveryBVO deliveryBVO[]=null;
//List<DeliveryBVO> deliveryBVO=new ArrayList<DeliveryBVO>();
//fstatusflag //1=自由,2=审批通过,3=冻结,4=关闭,7=审批中,8=审批不通过,5=失效,
//获取销售发货单(4331) 进行审批 产生 销售出库单 (4C)
deliveryHVO = (nc.vo.so.m4331.entity.DeliveryHVO) bd.executeQuery("select * from jpncdb1.so_delivery where dr=0 and vbillcode ='"+vsourcebillcode2+"'", new BeanProcessor(nc.vo.so.m4331.entity.DeliveryHVO.class));
if (deliveryHVO != null)
String so_delivery_pk=deliveryHVO.getAttributeValue("cdeliveryid").toString();//主键
//deliveryBVO[0] = (nc.vo.so.m4331.entity.DeliveryBVO) bd.executeQuery("select * from jpncdb1.so_delivery_b where dr=0 and cdeliveryid ='"+so_delivery_pk+"'", new BeanProcessor(nc.vo.so.m4331.entity.DeliveryBVO.class));
SuperVO[] deliveryBVO = HYPubBO_Client.queryByCondition(DeliveryBVO.class, " cdeliveryid = '"+so_delivery_pk+"'");
//deliveryBVO=(List<DeliveryBVO>) bd.executeQuery("select * from jpncdb1.so_delivery_b where dr=0 and cdeliveryid ='"+so_delivery_pk+"'", new BeanListProcessor(DeliveryBVO.class));
String[] users = "hcj";
// 30 4331 4C
//String flag2 = PfUtilTools.approveSilently("4331",so_delivery_pk, "Y", "批准","hcj",null);
//String flag2 = PfUtilTools.approveSilently("4C-Cxx-001",so_delivery_pk, "Y", "", "APPROVE",null);
//String flag2 = PfUtilTools.approveSilently("4331",so_delivery_pk,null, null, "APPROVE",null);
//System.out.println(flag2);
//IplatFormEntry iIplatFormEntry = NCLocator.getInstance().lookup(IplatFormEntry.class);
IplatFormEntry iIplatFormEntry = (IplatFormEntry) NCLocator.getInstance().lookup(IplatFormEntry.class.getName());
InvocationInfoProxy.getInstance().setGroupId("00013910000000000N4S");
AggregatedValueObject deliveryVO= new nc.vo.so.m4331.entity.DeliveryVO();
//deliveryVO
//nc.vo.so.m4331.entity.DeliveryVO
deliveryVO.setParentVO(deliveryHVO);
deliveryVO.setChildrenVO(deliveryBVO);
HashMap map = new HashMap();
map.put("notechecked", "notechecked");
Object processAction = iIplatFormEntry.processAction("APPROVE", "4331", null, deliveryVO,null, map);
System.out.println(processAction);
//流程平台动作处理 服务接口
//destBill是aggvo
/*BillQuery<DeliveryBillHVO> billquery = new BillQuery(DeliveryBillHVO.class);
DeliveryBillHVO[] aggvo=billquery.query(new String[] so_delivery_pk);
*/
/*IMDPersistenceQueryService service=NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
QueryCondition queryCondition=new QueryCondition(src_class);
queryCondition.addCondition(Restrictions.and(Restrictions.eq("vbillcode", billcode), Restrictions.eq("dr", 0)));
service.queryBillOfVOByCond(queryCondition, false);
*/
//DeliveryBillHVO[] obj= (DeliveryBillHVO[]) ifbaction.processAction("WRITE", "4331", null, aggvo, null, null);
//Object retObj = new PfUtilBO().processAction("APPROVE", "4331", "2005-05-30 12:23:44", null, billVo, userObj );
catch (Exception e1)
e1.printStackTrace();
String resultstr2 = "";
JSONObject backinfojson2=new JSONObject();
backinfojson2.put("$successful", "Y");
backinfojson2.put("sendresult", "");
resultstr2=backinfojson2.toString();
boolean flag = true;
if(flag)
return resultstr2;
String pk_org = orderjson.getString("pk_orgcode"); //库存组织 10202 pk_orgcode
String vtrantypecode = orderjson.getString("ctrantypecode"); //出入库类型编码 4C-Cxx-001 ctrantypecode
String cwarehouseid = orderjson.getString("cwarehousecode"); //仓库 X06 cwarehousecode
String cwhsmanagerid = orderjson.getString("cwhsmanagercode"); //库管员 08708 cwhsmanagercode
String cbizid = orderjson.getString("cbizcode"); //业务员 0110 cbizcode
String cdptvid = orderjson.getString("cdptcode"); //部门 "" cdptcode
String ccustomerid = orderjson.getString("ccustomercode"); //订单客户 070204 ccustomercode
//String ntotalnum = orderjson.getString("ntotalnum"); //总数量会自动计算
String cfanaceorgoid = orderjson.getString("cfanaceorgcode"); //结算财务组织 100 cfanaceorgcode
String cbiztype = orderjson.getString("cbiztype"); //业务流程 Cxx-001
String dbilldate = orderjson.getString("dbilldate"); //单据日期 2021-09-07 08:33:49
String trafficorgoid = orderjson.getString("trafficorgoid"); //物流组织 101
String freplenishflag = orderjson.getString("freplenishflag");// 销售退货 N
String boutretflag = orderjson.getString("boutretflag"); //销售退回 N
String fbillflag = orderjson.getString("fbillflag"); //单据状态 2
String vnote = orderjson.getString("vnote"); //备注
String vdef2 = orderjson.getString("vdef2"); //表头自定义项2 02
String creator = orderjson.getString("creator"); //创建人 hcj
String billmaker = orderjson.getString("billmaker"); //制单人 hcj
String csaleorgoid = orderjson.getString("csaleorgoid"); //销售组织 101
String creceivfinorgoid = orderjson.getString("creceivfinorgoid"); //应收财务组织 100
String ctrantypeid = orderjson.getString("ctrantypeid"); //出入库类型 4C-Cxx-001
String creationtime = getDateStr(new Date(),"yyyy-MM-dd HH:mm:ss"); //制单日期
//子表
JSONArray body = (JSONArray) orderjson.get("body");
StringBuffer body_sb=new StringBuffer();
for (int i = 0;i<body.size();i++)
JSONObject tmpb = body.getJSONObject(i);
String crowno = tmpb.getString("crowno"); // 行号10 crowno
String cmaterialoid = tmpb.getString("cmaterialoid"); //物料编码 91812160
String cunitid = tmpb.getString("cunitid"); // 主单位 012
String vfree1 = tmpb.getString("vfree1"); //自由辅助属性1 10014910000000002J0Q 颜色 0002
String nshouldnum = tmpb.getString("nshouldnum"); //应发主数量 5
String nnum = tmpb.getString("nnum"); //实发主数量 5
String price = tmpb.getString("price");// 单价 1000
//String money = tmpb.getString("money"); //金额 5000
String dbizdate = tmpb.getString("dbizdate");//出库日期 2021-10-09 10:12:22
String cinvoicecustid = tmpb.getString("cinvoicecustid"); //开票客户 350135
String csourcebillhid = tmpb.getString("csourcebillhid"); //来源单据表头主键 1001AZ10000001C3AK7J
String csourcebillbid = tmpb.getString("csourcebillbid"); //来源单据表体主键 1001AZ10000001C3AK7K
String csourcetype = tmpb.getString("csourcetype"); //来源单据类型 4331
String csourcetranstype = tmpb.getString("csourcetranstype"); //来源交易类型 4331-Cxx-001
String vsourcebillcode = tmpb.getString("vsourcebillcode"); //来源单据号 GFH210900002
String vsourcerowno = tmpb.getString("vsourcerowno"); //来源单据行号 10
String casscustid = tmpb.getString("casscustid"); //客户 350135
String cfirsttype = tmpb.getString("cfirsttype"); //源头单据类型 30
String cfirsttranstype = tmpb.getString("cfirsttranstype"); //源头交易类型 30
String cfirstbillhid = tmpb.getString("cfirstbillhid"); //源头单据号pk //1001AZ10000001C3AK6U
String cfirstbillbid = tmpb.getString("cfirstbillbid"); //源头单据行号pk //1001AZ10000001C3AK6Z
String vfirstbillcode = tmpb.getString("vfirstbillcode"); //源头单据号 GXD210900006
String vfirstrowno = tmpb.getString("vfirstrowno"); //源头单据行号 10
String vnotebody = tmpb.getString("vnotebody"); //行备注
String flargess = tmpb.getString("flargess"); //赠品 N
String bsourcelargess = tmpb.getString("bsourcelargess"); //上游赠品行 N
String bonroadflag = tmpb.getString("bonroadflag"); //在途 N
String cbodytranstypecode = tmpb.getString("cbodytranstypecode"); //出入库类型 4C-Cxx-001
String cbodywarehouseid = tmpb.getString("cbodywarehouseid"); //库存仓库 X06
//String pk_org = tmpb.getString("pk_org"); //库存组织 10202
String ddeliverdate = tmpb.getString("ddeliverdate"); //要求收货日期 2021-09-07 08:33:49
String norignetprice = tmpb.getString("norignetprice"); //主无税净价 1000
String norigtaxnetprice = tmpb.getString("norigtaxnetprice"); // 主含税净价 1000
String csourcebilldate = tmpb.getString("csourcebilldate"); //来源单据日期 2021-09-07 08:33:49
String cfirstbilldate = tmpb.getString("cfirstbilldate"); //源头单据日期 2021-09-07 08:33:49
//总价
//金额= 数量*单价
BigDecimal bd_num = new BigDecimal(nnum);//数量
BigDecimal bd_price = new BigDecimal(price).setScale(3, RoundingMode.HALF_UP);//单价
BigDecimal bd_total = bd_num.multiply(bd_price);//总价
BaseDAO bd_color = new BaseDAO();
String pk_defdoc = "";
try
//颜色代码查询
pk_defdoc = (String) bd_color.executeQuery("SELECT pk_defdoc FROM bd_defdoc WHERE pk_defdoclist = '10014910000000002GJJ' and code = '"+vfree1+"'", new ColumnProcessor());
catch (DAOException e)
e.printStackTrace();
StringBuffer body_sb2 = new StringBuffer();
JSONArray body2 = (JSONArray) tmpb.get("body");
for (int j = 0;j<body2.size();j++)
JSONObject tmpb2= body2.getJSONObject(j);
//String nnum_2 = tmpb2.getString("nnum");
String nnum_2 = nnum; //主数量 2
body_sb2.append(SetIcSaleoutXml.setPoOrderBody2(nnum_2));
body_sb.append(SetIcSaleoutXml.setPoOrderBody(body_sb2.toString(), crowno, cmaterialoid, cunitid, vfree1, nshouldnum,
nnum, price, bd_total.toString(), dbizdate, cinvoicecustid, csourcebillhid, csourcebillbid, csourcetype,
csourcetranstype, vsourcebillcode, vsourcerowno, casscustid, cfirsttype, cfirsttranstype, cfirstbillhid,
cfirstbillbid, vfirstbillcode, vfirstrowno, vnotebody, flargess, bsourcelargess, bonroadflag, cbodytranstypecode,
cbodywarehouseid, pk_org, ddeliverdate, norignetprice, norigtaxnetprice, csourcebilldate, cfirstbilldate));
xml_sb = SetIcSaleoutXml.setPoOrderHead(body_sb.toString(), "", "", cbiztype, dbilldate, vtrantypecode, pk_org, cwarehouseid, trafficorgoid,
cwhsmanagerid, cbizid, ccustomerid, freplenishflag, boutretflag, fbillflag, vnote, vdef2, creator, billmaker, creationtime,
cdptvid, csaleorgoid, cfanaceorgoid, creceivfinorgoid, ctrantypeid);
//
GetXChangeService gtxchangeservice=new GetXChangeService();
Object ovbillcode = "";
JSONObject backinfojson=gtxchangeservice.getXChangeservice(xml_sb.toString());
if(backinfojson.getString("$successful").equals("Y"))
String pk=backinfojson.getJSONObject("sendresult").getString("content");
BaseDAO bd = new BaseDAO();
try
//获取插入的订单单号
ovbillcode = bd.executeQuery("select vbillcode from ic_saleout_h where cgeneralhid ='"+pk+"'", new ColumnProcessor());
backinfojson.put("$vbillcode", ovbillcode);
catch (Exception e)
e.printStackTrace();
else if(backinfojson.getString("$successful").equals("N"))
backinfojson.put("$vbillcode",ovbillcode);
return backinfojson.toJSONString();
/**
* 修改
* @param operation
* @param orderform
* @return
*/
public String update(String operation,String orderform)
JSONObject orderjson = JSON.parseObject(orderform);
String vbillcode = orderjson.getString("vbillcode");//单据号
String pk = "";
JSONObject backinfojson=new JSONObject();
if (StringUtils.isBlank(vbillcode))
backinfojson.put("sendresult", "vbillcode为空!");
backinfojson.put("$successful", "N");
else
BaseDAO bd = new BaseDAO();
SaleOutHeadVO saleOutHeadVO=new SaleOutHeadVO();
try
saleOutHeadVO = (SaleOutHeadVO) bd.executeQuery("select * from ic_saleout_h where dr=0 and fbillflag <> 1 and vbillcode ='"+vbillcode+"'", new BeanProcessor(SaleOutHeadVO.class));
catch (Exception e1)
e1.printStackTrace();
if (saleOutHeadVO != null)
pk=saleOutHeadVO.getAttributeValue("cgeneralhid").toString();
if(StringUtils.isBlank(pk))
backinfojson.put("sendresult", "查询不到单据!");
backinfojson.put("$successful", "N");
else
StringBuffer xml_sb=new StringBuffer();
//String vbillcode = orderjson.getString("vbillcode");//单
String pk_org = orderjson.getString("pk_orgcode"); //库存组织 10202 pk_orgcode
String vtrantypecode = orderjson.getString("ctrantypecode"); //出入库类型编码 4C-Cxx-001 ctrantypecode
String cwarehouseid = orderjson.getString("cwarehousecode"); //仓库 X06 cwarehousecode
String cwhsmanagerid = orderjson.getString("cwhsmanagercode"); //库管员 08708 cwhsmanagercode
String cbizid = orderjson.getString("cbizcode"); //业务员 0110 cbizcode
String cdptvid = orderjson.getString("cdptcode"); //部门 "" cdptcode
String ccustomerid = orderjson.getString("ccustomercode"); //订单客户 070204 ccustomercode
//String ntotalnum = orderjson.getString("ntotalnum"); //总数量会自动计算
String cfanaceorgoid = orderjson.getString("cfanaceorgcode"); //结算财务组织 100 cfanaceorgcode
String cbiztype = orderjson.getString("cbiztype"); //业务流程 Cxx-001
String dbilldate = orderjson.getString("dbilldate"); //单据日期 2021-09-07 08:33:49
String trafficorgoid = orderjson.getString("trafficorgoid"); //物流组织 101
String freplenishflag = orderjson.getString("freplenishflag");// 销售退货 N
String boutretflag = orderjson.getString("boutretflag"); //销售退回 N
String fbillflag = orderjson.getString("fbillflag"); //单据状态 2
String vnote = orderjson.getString("vnote"); //备注
String vdef2 = orderjson.getString("vdef2"); //表头自定义项2 02
String creator = orderjson.getString("creator"); //创建人 hcj
String billmaker = orderjson.getString("billmaker"); //制单人 hcj
String csaleorgoid = orderjson.getString("csaleorgoid"); //销售组织 101
String creceivfinorgoid = orderjson.getString("creceivfinorgoid"); //应收财务组织 100
String ctrantypeid = orderjson.getString("ctrantypeid"); //出入库类型 4C-Cxx-001
String creationtime = getDateStr(new Date(),"yyyy-MM-dd HH:mm:ss"); //制单日期
//子表
JSONArray body = (JSONArray) orderjson.get("body");
StringBuffer body_sb=new StringBuffer();
for (int i = 0;i<body.size();i++)
JSONObject tmpb = body.getJSONObject(i);
String crowno = tmpb.getString("crowno"); // 行号10 crowno
String cmaterialoid = tmpb.getString("cmaterialoid"); //物料编码 91812160
String cunitid = tmpb.getString("cunitid"); // 主单位 012
String vfree1 = tmpb.getString("vfree1"); //自由辅助属性1 10014910000000002J0Q 颜色 0002
String nshouldnum = tmpb.getString("nshouldnum"); //应发主数量 5
String nnum = tmpb.getString("nnum"); //实发主数量 5
String price = tmpb.getString("price");// 单价 1000
//String money = tmpb.getString("money"); //金额 5000
String dbizdate = tmpb.getString("dbizdate");//出库日期 2021-10-09 10:12:22
String cinvoicecustid = tmpb.getString("cinvoicecustid"); //开票客户 350135
String csourcebillhid = tmpb.getString("csourcebillhid"); //来源单据表头主键 1001AZ10000001C3AK7J
String csourcebillbid = tmpb.getString("csourcebillbid"); //来源单据表体主键 1001AZ10000001C3AK7K
String csourcetype = tmpb.getString("csourcetype"); //来源单据类型 4331
String csourcetranstype = tmpb.getString("csourcetranstype"); //来源交易类型 4331-Cxx-001
String vsourcebillcode = tmpb.getString("vsourcebillcode"); //来源单据号 GFH210900002
String vsourcerowno = tmpb.getString("vsourcerowno"); //来源单据行号 10
String casscustid = tmpb.getString("casscustid"); //客户 350135
String cfirsttype = tmpb.getString("cfirsttype"); //源头单据类型 30
String cfirsttranstype = tmpb.getString("cfirsttranstype"); //源头交易类型 30
String cfirstbillhid = tmpb.getString("cfirstbillhid"); //源头单据号pk //1001AZ10000001C3AK6U
String cfirstbillbid = tmpb.getString("cfirstbillbid"); //源头单据行号pk //1001AZ10000001C3AK6Z
String vfirstbillcode = tmpb.getString("vfirstbillcode"); //源头单据号 GXD210900006
String vfirstrowno = tmpb.getString("vfirstrowno"); //源头单据行号 10
String vnotebody = tmpb.getString("vnotebody"); //行备注
String flargess = tmpb.getString("flargess"); //赠品 N
String bsourcelargess = tmpb.getString("bsourcelargess"); //上游赠品行 N
String bonroadflag = tmpb.getString("bonroadflag"); //在途 N
String cbodytranstypecode = tmpb.getString("cbodytranstypecode"); //出入库类型 4C-Cxx-001
String cbodywarehouseid = tmpb.getString("cbodywarehouseid"); //库存仓库 X06
//String pk_org = tmpb.getString("pk_org"); //库存组织 10202
String ddeliverdate = tmpb.getString("ddeliverdate"); //要求收货日期 2021-09-07 08:33:49
String norignetprice = tmpb.getString("norignetprice"); //主无税净价 1000
String norigtaxnetprice = tmpb.getString("norigtaxnetprice"); // 主含税净价 1000
String csourcebilldate = tmpb.getString("csourcebilldate"); //来源单据日期 2021-09-07 08:33:49
String cfirstbilldate = tmpb.getString("cfirstbilldate"); //源头单据日期 2021-09-07 08:33:49
//总价
//金额= 数量*单价
BigDecimal bd_num = new BigDecimal(nnum);//数量
BigDecimal bd_price = new BigDecimal(price).setScale(3, RoundingMode.HALF_UP);//单价
BigDecimal bd_total = bd_num.multiply(bd_price);//总价
BaseDAO bd_color = new BaseDAO();
String pk_defdoc = "";
try
//颜色代码查询
pk_defdoc = (String) bd_color.executeQuery("SELECT pk_defdoc FROM bd_defdoc WHERE pk_defdoclist = '10014910000000002GJJ' and code = '"+vfree1+"'", new ColumnProcessor());
catch (DAOException e)
e.printStackTrace();
StringBuffer body_sb2 = new StringBuffer();
JSONArray body2 = (JSONArray) tmpb.get("body");
for (int j = 0;j<body2.size();j++)
JSONObject tmpb2= body2.getJSONObject(j);
//String nnum_2 = tmpb2.getString("nnum");
String nnum_2 = nnum; //主数量 2
body_sb2.append(SetIcSaleoutXml.setPoOrderBody2(nnum_2));
body_sb.append(SetIcSaleoutXml.setPoOrderBody(body_sb2.toString(), crowno, cmaterialoid, cunitid, vfree1, nshouldnum,
nnum, price, bd_total.toString(), dbizdate, cinvoicecustid, csourcebillhid, csourcebillbid, csourcetype,
csourcetranstype, vsourcebillcode, vsourcerowno, casscustid, cfirsttype, cfirsttranstype, cfirstbillhid,
cfirstbillbid, vfirstbillcode, vfirstrowno, vnotebody, flargess, bsourcelargess, bonroadflag, cbodytranstypecode,
cbodywarehouseid, pk_org, ddeliverdate, norignetprice, norigtaxnetprice, csourcebilldate, cfirstbilldate));
xml_sb = SetIcSaleoutXml.setPoOrderHead(body_sb.toString(), pk,vbillcode , cbiztype, dbilldate, vtrantypecode, pk_org, cwarehouseid, trafficorgoid,
cwhsmanagerid, cbizid, ccustomerid, freplenishflag, boutretflag, fbillflag, vnote, vdef2, creator, billmaker, creationtime,
cdptvid, csaleorgoid, cfanaceorgoid, creceivfinorgoid, ctrantypeid);
//
GetXChangeService gtxchangeservice=new GetXChangeService();
backinfojson=gtxchangeservice.getXChangeservice(xml_sb.toString());
backinfojson.put("$vbillcode", vbillcode);
if(backinfojson.getString("$successful").equals("Y"))
String oldpk=backinfojson.getJSONObject("sendresult").getString("bdocid");
try
bd.deleteByClause(SaleOutHeadVO.class, "cgeneralhid='"+oldpk+"'");
bd.deleteByClause(SaleOutBodyVO.class, "cgeneralhid='"+oldpk+"'");
catch (Exception e)
// TODO Auto-generated catch block
e.printStackTrace();
String newpk=backinfojson.getJSONObject("sendresult").getString("content");
try
String sql="update ic_saleout_h set vbillcode='"+vbillcode+"' where cgeneralhid='"+newpk+"'";
bd.executeUpdate(sql);
catch (Exception e)
// TODO Auto-generated catch block
e.printStackTrace();
else
backinfojson.put("sendresult", "查询不到单据!");
backinfojson.put("$successful", "N");
return backinfojson.toJSONString();
/**
* 删除
* @param operation
* @param orderform
* @return
*/
public String delete(String operation,String orderform)
JSONObject orderjson=JSON.parseObject(orderform);
String vbillcode=orderjson.getString("vbillcode");
String pk=null;
JSONObject backinfojson=new JSONObject();
BaseDAO bd = new BaseDAO();
if (vbillcode == null || "".equals(vbillcode))
backinfojson.put("sendresult", "vbillcode为空!");
backinfojson.put("$successful", "N");
else
SaleOutHeadVO saleOutHeadVO = new SaleOutHeadVO();
try
String sql="select * from ic_saleout_h where vbillcode = '"+vbillcode+"' and dr=0 and fbillflag <> 1 ";
saleOutHeadVO = (SaleOutHeadVO) bd.executeQuery(sql, new BeanProcessor(SaleOutHeadVO.class));
catch (Exception e1)
e1.printStackTrace();
if (saleOutHeadVO != null)
pk=saleOutHeadVO.getAttributeValue("cgeneralhid").toString();
if(pk == null || "".equals(pk))
backinfojson.put("sendresult", "查询不到单据!");
backinfojson.put("$successful", "N");
else
//单据状态
if(saleOutHeadVO.getAttributeValue("fbillflag").toString().equals("2") || saleOutHeadVO.getAttributeValue("fbillflag").toString().equals("6"))
//orderHeaderVO.setAttributeValue("dr", "1");
saleOutHeadVO.setFbillflag(1);
try
bd.updateVO(saleOutHeadVO);
catch (Exception e)
e.printStackTrace();
List<SaleOutBodyVO> orderItemVOList=new ArrayList<SaleOutBodyVO>();
try
String sql="select * from ic_generalout_b where cgeneralhid = '"+pk+"' and dr=0 and fbillflag <> 1 ";
orderItemVOList=(List<SaleOutBodyVO>) bd.executeQuery(sql, new BeanListProcessor(SaleOutBodyVO.class));
catch (Exception e)
// TODO Auto-generated catch block
e.printStackTrace();
for (int i=0;i<orderItemVOList.size();i++)
orderItemVOList.get(i).setAttributeValue("dr", "1");
try
bd.updateVOList(orderItemVOList);
catch (Exception e)
// TODO Auto-generated catch block
e.printStackTrace();
backinfojson.put("$successful", "Y");
backinfojson.put("sendresult", "单据删除成功!");
else
backinfojson.put("$successful", "N");
backinfojson.put("sendresult", "单据状态不允许删除!");
return backinfojson.toString();
/**
* 查询
* @param operation
* @param orderform
* @return
*/
public String search(String operation,String orderform)
JSONObject backinfojson=new JSONObject();
backinfojson.put("$successful", "N");
backinfojson.put("sendresult", "未开放!");
return backinfojson.toString();
/**
* 判断字符串是否为JsonObject @link org.json.JSONObject
* @param jsonStr @link java.lang.String
* @return boolean
*/
public static boolean isJsonObject(final String jsonStr)
if (StringUtils.isBlank(jsonStr)) return false;
return Pattern.matches("^\\\\.*\\\\$", jsonStr.trim());
/**
* 日期转换为字符串
* @param date 日期
* @param format 日期格式
* @return 字符串
*/
public static String getDateStr(Date date,String format)
if (null == date)
return null;
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(date);
金蝶k3wise12.2版本有一单出库单生成发票提示不能将值插入列fauxprice,update失败。
...也遇到此类问题。现在与大家分享吧! 销售出库单中有一笔分录没有订单(有下级单据也能删除有点奇怪)。发货通知里面FAuxPrice字段为空值,自然销售出库也为空值。到了做销售发票FAuxPrice字段为空值就会跳... 查看详情
进销存软件的功能主要有哪些(代码片段)
进销存软件的功能主要有哪些呢?1.客户管理:公共客户池、客户分配、客户管理、客户三证上传、客户卡片、交往记录管理、客户漏斗图、超期客户预警、客户关怀、客户生日、客户转移、客户统计2.销售机会管理:项目机会管理... 查看详情
金蝶k3自定义销售出库单在哪里设置
...码进去)-进来里面是空白的然后点左上角单据打开选中销售出库单看表头还是表体直接右键就有新增了追问x系统工具未安装,要在哪里才能安装呢?追答就是安装软件的时候有自带的没有就去服务器上吧肯定有参考技术A尊敬的... 查看详情
k3中,预收单为啥不能和销售发票、其他应收单进行关联啊?
...合收入与成本的配比原则;同时提供发票之间对等核销的功能;核心业务三方关联,系统提供两种联系模式,一是作为销售核心单据的订单、发票和出库单之 查看详情
金蝶k3销售出库单不能审核,出现“审核单据时出错,”原因,由于数据移动,不能以nolock方式扫描
金蝶k3销售出库单不能审核,出现“审核单据时出错,”原因,由于数据移动,不能以NOLOCK方式扫描。该怎么办???参考技术A联系客服解决!实在不行就备份数据库,重装软件! 参考技术B做一个备份帐套,完后进行数据跟踪... 查看详情
金蝶k3销售出库单不能审核,出现“审核单据时出错,”原因,由于数据移动,不能以nolock方式扫描
在单据序时簿中选中该单据,然后点击下查可以查看是否有下游关联单据。关联的单据可能是红字入库单,也可能是退货通知单、生产领料单,也可能是调拔单等。参考技术A做一个备份帐套,完后进行数据跟踪。如果你是最终... 查看详情
用友erp系统,u9操作流程图
...构下的ERP软件。即客户机与服务器结构,是将系统的操作功能合理分配到Client端和Server端,此类架构下的ERP适合于企业内部使用局域网的情况,有局限性,保密性相对较强。2.B/S架构下的ERP软件。B/S架构,即浏览器和服务器结 查看详情
仓库一般有那些表格
...得库存的情况能够一目了然。仓库管理的第三类报表,是销售方面相关的,只要是有关于仓库里面的各种产品的相关销售情况,也都需要在这个报表里面进行记录,各个销售订单、或是销售退货的订单等等,这些也都需要并入到... 查看详情
wms仓储管理系统的功能有哪些?
常用的工厂仓储管理功能采购收货ERP系统内制作【暂收送检单】(作为通知品质检验及仓库收货的凭证)PDA扫描【暂收送检单单号】确认产品数量保存ERP系统内生成【采购收货单】采购退货以ERP中的退货为例:原材料... 查看详情
sap冲销销售订单后如何生成新的销售单
参考技术A查找到要重新拆单的销售订单单据号,输入事务码VA03进入后,通过凭证流查询到该单据的后续交货单号。并记录下该订单前端引用的预订单号。2.通过事务码VL09冲销交货单,VL02N删除交货单,VA02删除销售订单。3.创建新的销... 查看详情
保证接口幂等性的解决方案(后台)(代码片段)
假如有个服务提供一个接口(服务部署在多个服务机器),接着有个接口是付款接口。用户在前端上操作的时候,一个订单不小心发起了两次支付请求,然后这两个请求分散在了这个服务部署的不同的机器上,结果一个订单扣款... 查看详情
第三轮面试
1、描述一下你上一家公司SSM项目的功能模块有哪些?举的例子是一个用SSM做的一个进销存的系统具体模块如下:资料管理:包括商品资料、客户资料、供应商资料、仓库信息、采购合同、销售合同等。采购管理:进货单、退货管理... 查看详情
移动crm帮助企业打造超强销售团队
...单机率、提高赢单效率。灵活运用crm的销售打单最佳实践功能,企业就可以批量复制顶尖销售,更可以加快销售的赢单速度。销售团队更高效移动crm可以让销售无论是在公司还是在外跑业务,都可以通过电脑、手机和平板电脑进... 查看详情
用友u8盘点单审核提示零库存控制,审核失败的解决办法(代码片段)
...式设置有问题,但是检查选项确实勾选了待发货量: 后台也没有查询到未审核的发货记录:select*fromDispatchListsaleftjoinDispatchListbona.DLID=b.DLIDwherea.cinvcode=‘0601010201-0009‘anda.cWhCode=‘0408‘andb.dverifydateisnull看来,唯一的问题只能... 查看详情
期未课程设计:使用ssm开发产品销售管理系统(代码片段)
...用户登陆主要功能展示如下:管理员登陆系统:后台登陆页面销售信息统计分析销售经理跟单信息查询对跟单的审批意见其它功能的实现:添加客户,添加商品,查询订单销售人员注册登陆注册销售人员登陆... 查看详情
erp产品销售发货判断库存功能(四十二)
产品数量的前端(键盘抬起的事件):<td><inputtype="text"name="proCount"onkeyup="isProCountFull(this)"class="{required:true,min:1,digits:true}"style="width:100px"/></td> js代码:<scripttype="text/ 查看详情
最大单笔销售利润
】最大单笔销售利润【英文标题】:Maximumsingle-sellprofit【发布时间】:2011-10-2812:36:14【问题描述】:假设我们有一个n个整数数组,表示一天的股票价格。我们希望找到一对(buyDay,sellDay),其中buyDay≤sellDay,这样如果我们在buyDay买... 查看详情
出入库单据类型
...ame1 外购入库单2 产品入库单5 委外入库单10 其他入库单21 销售出库单24 领料单28 委外出库单29 其他出库单40 盘盈单41 调拨单43 盘亏单100 成本调整单101 外购入库暂估补差单102 委外加工暂估补差单——————&md... 查看详情