Browse Source

[update]销售管理:销售订单信息添加物料销售报价添加计划交付时间,质保天数。

dev
zhangsiqi 7 months ago
parent
commit
d22d9cad69
  1. 22
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrderChild.java
  2. 25
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java
  3. 32
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml
  4. 76
      ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html
  5. 22
      ruoyi-admin/src/main/resources/templates/system/salesOrder/detail.html
  6. 198
      ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html

22
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrderChild.java

@ -112,6 +112,10 @@ public class SysSalesOrderChild extends BaseEntity {
@Excel(name = "物料的不含税总价(RMB)")
private Double materialRmbSum;
@Excel(name = "计划交付时间")
private String deliveryTime;
@Excel(name = "质保天数")
private String expiryDay;
/*业务人员*/
@Excel(name = "业务人员")
private String businessMembers;
@ -355,6 +359,22 @@ public class SysSalesOrderChild extends BaseEntity {
this.materialRmbSum = materialRmbSum;
}
public String getDeliveryTime() {
return deliveryTime;
}
public void setDeliveryTime(String deliveryTime) {
this.deliveryTime = deliveryTime;
}
public String getExpiryDay() {
return expiryDay;
}
public void setExpiryDay(String expiryDay) {
this.expiryDay = expiryDay;
}
public String getBusinessMembers() {
return businessMembers;
}
@ -435,6 +455,8 @@ public class SysSalesOrderChild extends BaseEntity {
.add("materialNoUsdSum", materialNoUsdSum)
.add("materialNoRmbSum", materialNoRmbSum)
.add("materialRmbSum", materialRmbSum)
.add("deliveryTime", deliveryTime)
.add("expiryDay", expiryDay)
.add("businessMembers", businessMembers)
.add("confirmTax", confirmTax)
.add("taxRate", taxRate)

25
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java

@ -201,16 +201,23 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService
sysSalesOrder.setUpdateBy(loginName);
sysSalesOrder.setUpdateTime(new Date());
// 存在提交完就流程结束的情况
if(sysSalesOrder.getSysSalesOrderChildList() != null){
if(sysSalesOrder.getSysSalesOrderChildList().size() > 0){
//1.1.销售订单物料的前台上传新的报价列表,修改后台存在的报价猎豹,以报价编号为索引
//获取传输的销售订单物料报价信息
List<SysSalesOrderChild> sysSalesOrderChildList = sysSalesOrder.getSysSalesOrderChildList();
for (SysSalesOrderChild sysSalesOrderChild:sysSalesOrderChildList) {
if (sysSalesOrderChild.getId() != null && sysSalesOrderChild.getId() != 0){
sysSalesOrderChildService.updateSysSalesOrderChild(sysSalesOrderChild);
}else{
sysSalesOrderChild.setQuoteId(sysSalesOrder.getSalesOrderCode());
sysSalesOrderChildService.insertSysSalesOrderChild(sysSalesOrderChild);
}
}
String[] ids = {sysSalesOrder.getSalesOrderCode()};
sysSalesOrderChildService.deleteSysSalesOrderChildByQuoteIds(ids);
//获取已上传的销售订单物料报价信息
sysSalesOrderChildService.selectSysSalesOrderChildByQuoteId(sysSalesOrder.getSalesOrderCode());
for (int i = 0; i < sysSalesOrderChildList.size(); i++) {
SysSalesOrderChild sysSalesOrderChild = sysSalesOrderChildList.get(i);
sysSalesOrderChild.setQuoteId(sysSalesOrder.getSalesOrderCode());
sysSalesOrderChild.setCreateBy(loginName);
sysSalesOrderChild.setUpdateBy(loginName);
sysSalesOrderChild.setUpdateTime(new Date());
sysSalesOrderChild.setQuoteId(sysSalesOrder.getSalesOrderCode());
sysSalesOrderChildService.insertSysSalesOrderChild(sysSalesOrderChild);
}
}
int result = sysSalesOrderMapper.updateSysSalesOrder(sysSalesOrder);
return result;

32
ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml

@ -27,6 +27,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialNoUsdSum" column="materialNoUsdSum" />
<result property="materialNoRmbSum" column="materialNoRmbSum" />
<result property="materialRmbSum" column="materialRmbSum" />
<result property="deliveryTime" column="delivery_time" />
<result property="expiryDay" column="expiry_day" />
<result property="outBoundQuantity" column="out_bound_quantity" />
<result property="unBoundQuantity" column="un_bound_quantity" />
<result property="createBy" column="create_by" />
@ -42,7 +44,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectSysSalesOrderChild">
select a.id, a.quoteId, a.materialId, a.materialCode, a.materialName, a.materialType, a.processMethod, a.brand, a.photoUrl,a.unit, a.`describe`,
a.countTax, a.usdTax, a.materialNum,a.materialSole, a.materialRmb, a.materialNoRmb, a.materialNoUsd, a.materialUsd, a.materialUsdSum,
a.materialNoUsdSum, a.materialNoRmbSum, a.materialRmbSum,a.out_bound_quantity, a.un_bound_quantity, a.create_by, a.create_time, a.update_by,
a.materialNoUsdSum, a.materialNoRmbSum, a.materialRmbSum,a.delivery_time, a.expiry_day,
a.out_bound_quantity, a.un_bound_quantity, a.create_by, a.create_time, a.update_by,
a.update_time, a.remark, a.use_status,a.audit_status
,b.id as bom_id
from sys_sales_order_child a
@ -54,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="quoteId != null and quoteId !='' "> and a.quoteId = #{quoteId}</if>
<if test="materialId != null "> and a.materialId = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and a.materialCode like concat('%', #{#{materialCode}}, '%')</if>
<if test="materialCode != null and materialCode != ''"> and a.materialCode like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and a.materialName like concat('%', #{materialName}, '%')</if>
</where>
</select>
@ -91,12 +94,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNoUsdSum != null">materialNoUsdSum,</if>
<if test="materialNoRmbSum != null">materialNoRmbSum,</if>
<if test="materialRmbSum != null">materialRmbSum,</if>
<if test="deliveryTime != null">delivery_time,</if>
<if test="expiryDay != null">expiry_day,</if>
<if test="outBoundQuantity != null">out_bound_quantity,</if>
<if test="unBoundQuantity != null">un_bound_quantity,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="remark != null">remark,</if>
use_status,audit_status,create_time
<if test="useStatus != null">use_status,</if>
<if test="auditStatus != null">audit_status,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="quoteId != null">#{quoteId},</if>
@ -121,11 +129,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNoUsdSum != null">#{materialNoUsdSum},</if>
<if test="materialNoRmbSum != null">#{materialNoRmbSum},</if>
<if test="materialRmbSum != null">#{materialRmbSum},</if>
<if test="deliveryTime != null">#{deliveryTime},</if>
<if test="expiryDay != null">#{expiryDay},</if>
<if test="outBoundQuantity != null">#{outBoundQuantity},</if>
<if test="unBoundQuantity != null">#{unBoundQuantity},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="remark != null">#{remark},</if>
0,0,now()
<if test="useStatus != null">#{useStatus},</if>
<if test="auditStatus != null"> #{auditStatus},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
@ -154,17 +168,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNoUsdSum != null">materialNoUsdSum = #{materialNoUsdSum},</if>
<if test="materialNoRmbSum != null">materialNoRmbSum = #{materialNoRmbSum},</if>
<if test="materialRmbSum != null">materialRmbSum = #{materialRmbSum},</if>
<if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
<if test="expiryDay != null">expiry_day = #{expiryDay},</if>
<if test="outBoundQuantity != null">out_bound_quantity = #{outBoundQuantity},</if>
<if test="unBoundQuantity != null">un_bound_quantity = #{unBoundQuantity},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="useStatus != null">use_status = #{useStatus},</if>
update_time = now()
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysSalesOrderChildById" parameterType="Long">
delete from sys_sales_order_child where id = #{id}
</delete>

76
ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html

@ -324,9 +324,8 @@
columns: [
{checkbox: true},
{field: 'index',align: 'center', title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
formatter: function (value, row, index,column) {
return column;
}
},
{title: '物料索引id',field: 'materialId',align: 'center',visible: false},
@ -406,35 +405,38 @@
field: 'materialRmbSum',
align: 'center',
},
{
field: 'createBy',
align: 'center',
title: '录入人',
visible: false
},
{
field: 'createTime',
align: 'center',
title: '录入时间',
visible: false
},
{
field: 'updateBy',
{ title: '计划交付时间',
field: 'deliveryTime',
align: 'center',
title: '更新人',
visible: false
editable: {
type: 'date',
title: '计划交付时间',
}
},
{
field: 'updateTime',
title: '质保天数',
align: 'center',
title: '上次更新时间',
visible: false
field: 'expiryDay',
editable: {
type: 'text',
emptytext: "天数",
title: '质保天数',
validate: function (value) { //字段验证
if (!$.trim(value)) {
return '不能为空';
}else{
return value + "天数";
}
}
},
format: function (value, row, index) {
return value + "天数";
}
},
{
field: 'remark',
align: 'center',
title: '备注',
visible: false
},
{
field: 'auditStatus',
@ -449,7 +451,7 @@
{title: '操作', align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join('');
}
}
@ -469,7 +471,6 @@
}else{
usd = Number(usd).toFixed(2);
}
console.log(commonCurrency1);
if(commonCurrency1 == 1){
row.materialNoRmb = Number(row.materialNoRmb).toFixed(2);
row.materialRmb = Number(row.materialNoRmb * Number(1 + rmb));
@ -656,14 +657,10 @@
});
/*业务员列表*/
//获取单号
$("#form-salesOrder-add").validate({
focusCleanup: true
});
$("#form-salesOrder-add").validate({focusCleanup: true});
function doSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
console.log("rowData: "+rowData);
$("#bootstrap-sub-table-order").bootstrapTable('insertRow', {
index:1,
row: {
@ -676,10 +673,10 @@
unit: rowData.unit,
processMethod: rowData.processMethod,
photoUrl: rowData.photoUrl,
countTax: '',
usdTax: '',
countTax: $("#taxRate_add").val(),
usdTax: $("#usdTax_add").val(),
materialSole: "",
materialNum: 0,
materialNum: 1,
materialNoRmb: 0.00,
materialNoUsd: 0.00,
materialRmb: 0.00,
@ -715,10 +712,15 @@
$.modal.openOptions(options);
}
/* 删除指定表格行 */
function removeRow(index){
$("#bootstrap-sub-table-order").bootstrapTable('remove', {
field: 'index',
values: index
function removeRow(){
var ids = $.table.selectColumns("id");
if (ids.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$("#bootstrap-sub-table-editOrder1").bootstrapTable('remove', {
field: 'id',
values: ids
})
}
function getTotalAmount(){

22
ruoyi-admin/src/main/resources/templates/system/salesOrder/detail.html

@ -306,6 +306,7 @@
<i class="fa fa-plus"></i> 添加物料
</a>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
@ -556,11 +557,8 @@
function queryParams(params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
quoteId: sysSalesOrder.salesOrderCode,
};
curParams.quoteId = sysSalesOrder.salesOrderCode;
quoteId : sysSalesOrder.salesOrderCode
}
return curParams;
}
/*业务员列表*/
@ -601,6 +599,7 @@
index: 1,
row: {
id:'',
quoteId:'',
materialId:rowData.id,
materialCode: rowData.materialNo,
materialName: rowData.materialName,
@ -637,10 +636,15 @@
$.modal.openOptions(options);
}
/* 删除指定表格行 */
function removeRow(index){
$("#bootstrap-sub-table-editOrder").bootstrapTable('remove', {
field: 'index',
value: index
function removeRow(){
var ids = $.table.selectColumns("id");
if (ids.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$("#bootstrap-sub-table-1").bootstrapTable('remove', {
field: 'id',
values: ids
})
}
$("input[name='pricingDate']").datetimepicker({

198
ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html

@ -84,8 +84,7 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">客户ID:</label>
<div class="col-sm-8">
<select id="enterpriseCode_edit" name="enterpriseCode" class="form-control m-b" required>
</select>
<input id="enterpriseCode_edit" th:field="*{enterpriseCode}" name="enterpriseCode" class="form-control m-b" required readonly/>
</div>
</div>
<div class="form-group">
@ -103,8 +102,7 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">客户联系人:</label>
<div class="col-sm-8">
<select id="customerContact_edit" name="customerContact" th:field="*{customerContact}" class="form-control m-b" required>
</select>
<input id="customerContact_edit" name="customerContact" th:field="*{customerContact}" class="form-control m-b" required readonly />
</div>
</div>
<div class="form-group">
@ -122,26 +120,25 @@
<div class="form-group">
<label class="col-sm-3 control-label">联系人邮箱:</label>
<div class="col-sm-8">
<input name="contactEmail" th:field="*{contactEmail}" class="form-control" type="text" required>
<input name="contactEmail" th:field="*{contactEmail}" class="form-control" type="text" required readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">客户收货人:</label>
<div class="col-sm-8">
<select name="customerDelivery" id="customerDelivery_edit" th:field="*{customerDelivery}" class="form-control m-b" >
</select>
<input name="customerDelivery" id="customerDelivery_edit" th:field="*{customerDelivery}" class="form-control m-b" disabled/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">收货人电话:</label>
<div class="col-sm-8">
<input name="deliveryPhone" th:field="*{deliveryPhone}" class="form-control" type="text" />
<input name="deliveryPhone" th:field="*{deliveryPhone}" class="form-control" type="text" disabled/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">收货地址:</label>
<div class="col-sm-8">
<input name="deliveryAddress" th:field="*{deliveryAddress}" class="form-control" type="text" required>
<input name="deliveryAddress" th:field="*{deliveryAddress}" class="form-control" type="text" required disabled>
</div>
</div>
<div class="form-group">
@ -153,7 +150,7 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">订单类型:</label>
<div class="col-sm-8">
<select name="salesOrderType" class="form-control" type="text" th:with="dictList=${@dict.getType('sys_order_type')}" required>
<select name="salesOrderType" class="form-control" th:field="*{salesOrderType}" th:with="dictList=${@dict.getType('sys_order_type')}" required>
<option value="">请选择</option>
<option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
</select>
@ -163,7 +160,7 @@
<label class="col-sm-3 control-label">接单日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="orderReceivingTime" class="form-control" th:field="*{orderReceivingTime}" placeholder="yyyy-mm-dd" type="text">
<input name="orderReceivingTime" class="form-control" th:value="*{orderReceivingTime}" placeholder="yyyy-mm-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
@ -175,9 +172,10 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">报价币种:</label>
<label class="col-sm-3 control-label is-required">报价币种:</label>
<div class="col-sm-8">
<select class="form-control" id="commonCurrency_edit" name="commonCurrency" th:with="dictList=${@dict.getType('sys_common_currency')}" th:field="*{commonCurrency}" required>
<select class="form-control" id="commonCurrency_edit" name="commonCurrency"
th:with="dictList=${@dict.getType('sys_common_currency')}" th:field="*{commonCurrency}" required>
<option value="">请选择</option>
<option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
</select>
@ -193,7 +191,7 @@
<label class="col-sm-3 control-label is-required">是否含税:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_confirm_tax')}">
<input required type="radio" th:id="${'confirmTax_' + dict.dictCode}"
<input required type="radio" th:id="${'confirmTax_' + dict.dictCode}" th:field="*{confirmTax}"
name="confirmTax" th:value="${dict.dictValue}">
<label th:for="${'confirmTax_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
@ -202,14 +200,14 @@
<div class="form-group">
<label class="col-sm-3 control-label">税率:</label>
<div class="col-sm-8">
<input name="taxRate" id="taxRate_edit" th:field="*{taxRate}" class="form-control" type="number">
<input name="taxRate" id="taxRate_edit" th:field="*{taxRate}" class="form-control" type="number" >
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">是否开票:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_whether')}">
<input required type="radio" th:id="${'invoice_' + dict.dictCode}"
<input required type="radio" th:id="${'invoice_' + dict.dictCode}" th:field="*{invoice}"
name="invoice" th:value="${dict.dictValue}">
<label th:for="${'invoice_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
@ -265,7 +263,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">业务员:</label>
<label class="col-sm-3 control-label is-required">业务员:</label>
<div class="col-sm-8">
<select name="businessMembers" class="form-control m-b" th:field="*{businessMembers}" required>
</select>
@ -302,11 +300,14 @@
<a class="btn btn-success" onclick="insertRow()">
<i class="fa fa-plus"></i> 添加物料
</a>
<a class="btn btn-danger" onclick="removeRow()">
<i class="fa fa-plus"></i> 删除物料
</a>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-editOrder"></table>
<table id="bootstrap-table-editOrder"></table>
</div>
</div>
</div>
@ -315,7 +316,6 @@
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-table-editable-js"/>
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
var prefix = ctx + "system/salesOrder";
var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]];
@ -327,18 +327,19 @@
$("#form-salesOrder-edit").validate({focusCleanup: true});
$(function() {
var options = {
id:'bootstrap-sub-table-editOrder',
id:'bootstrap-table-editOrder',
url: ctx + "system/orderChild/list",
pagination: false,
queryParams: queryParams,
sidePagination: "client",
uniqueId: "index",
model: "物料报价信息",
columns: [
{checkbox: true},
{field: 'id',title: '主键id',align: 'center',visible: false},
{field: 'index',align: 'center', title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
return index + 1;
}
},
{title: '物料索引id',field: 'materialId',align: 'center',visible: false},
@ -399,6 +400,18 @@
{ title: '物料的不含税总价(美元)',field: 'materialNoUsdSum',align: 'center'},
{ title: '物料的含税总价(RMB)',field: 'materialNoRmbSum', align: 'center'},
{ title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center'},
{ title: '计划交付时间',field: 'deliveryTime',align: 'center',
editable: {type: 'date',title: '计划交付时间',format: 'yyyy-mm-dd', emptytext: "计划交付时间",
formatter: function (value, row, index) {
return value;
}}
},
{title: '质保天数',align: 'center',field: 'expiryDay',
editable: {type: 'text',emptytext: "天数",title: '质保天数',formatter: function (value, row, index) {
return value + "天数";
}},
},
{ title: '录入人',field: 'createBy',align: 'center',visible: false},
{ title: '录入时间',field: 'createTime',align: 'center',visible: false},
{ title: '更新人',field: 'updateBy',align: 'center',visible: false},
@ -412,7 +425,7 @@
{title: '操作', align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.index + '\')"><i class="fa fa-remove"></i>删除</a> ');
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + index + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join('');
}
}
@ -420,60 +433,62 @@
onEditableSave:function(field, row, oldValue, $el){
var commonCurrency1 = $("#commonCurrency_edit option:selected").val();
var rmb1 = $("#taxRate_edit").val();
if (rmb1 =='' || rmb1== null){
if (rmb1== null){
rmb1 = 0;
}else{
rmb1 = $("#taxRate_edit").val();
}
var rmb = Number(rmb1).toFixed(2) / 100;
var rmb = parseFloat(rmb1).toFixed(2) / 100;
var usd = $("#usdTax_edit").val();
if (usd =='' || usd== null){
if (usd== null){
usd = 0;
}else{
usd = Number(usd).toFixed(2);
usd = parseFloat(usd).toFixed(2);
}
if(commonCurrency1 == 1){
row.materialNoRmb = Number(row.materialNoRmb).toFixed(2);
row.materialRmb = Number(row.materialNoRmb * Number(1 + rmb));
row.materialNoRmbSum = Number(row.materialNum * Number(row.materialNoRmb)).toFixed(2);
row.materialRmbSum = Number(row.materialRmb * row.materialNum).toFixed(2);
row.materialNoUsd = Number(row.materialNoRmb / usd).toFixed(2);
row.materialNoUsdSum = Number(row.materialNum * row.materialNoUsd).toFixed(2);
row.materialUsd = Number(row.materialNoUsd).toFixed(2)
row.materialUsdSum = Number(row.materialNum * Number(row.materialUsd)).toFixed(2);
row.materialNoRmb = parseFloat(row.materialNoRmb).toFixed(2);
row.materialRmb = parseFloat(row.materialNoRmb * parseFloat(1 + rmb));
row.materialNoRmbSum = parseFloat(row.materialNum * parseFloat(row.materialNoRmb)).toFixed(2);
row.materialRmbSum = parseFloat(row.materialRmb * row.materialNum).toFixed(2);
row.materialNoUsd = parseFloat(row.materialNoRmb / usd).toFixed(2);
row.materialNoUsdSum = parseFloat(row.materialNum * row.materialNoUsd).toFixed(2);
row.materialUsd = parseFloat(row.materialNoUsd).toFixed(2)
row.materialUsdSum = parseFloat(row.materialNum * parseFloat(row.materialUsd)).toFixed(2);
}
else if( commonCurrency1 == 2){
row.materialNoUsd = Number(row.materialNoUsd).toFixed(2);
row.materialUsd = Number(row.materialNoUsd).toFixed(2);
row.materialUsdSum = Number(row.materialNum * row.materialUsd).toFixed(2);
row.materialNoUsdSum = Number(row.materialNoUsd * row.materialNum).toFixed(2);
row.materialNoRmb = Number(row.materialNoUsd * usd).toFixed(2);
row.materialRmb = Number(row.materialNoRmb * (1 + rmb)).toFixed(2);
row.materialNoRmbSum = Number(row.materialNoRmb * row.materialNum).toFixed(2);
row.materialRmbSum = Number(row.materialRmb * row.materialNum).toFixed(2);
row.materialNoUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsdSum = parseFloat(row.materialNum * row.materialUsd).toFixed(2);
row.materialNoUsdSum = parseFloat(row.materialNoUsd * row.materialNum).toFixed(2);
row.materialNoRmb = parseFloat(row.materialNoUsd * usd).toFixed(2);
row.materialRmb = parseFloat(row.materialNoRmb * (1 + rmb)).toFixed(2);
row.materialNoRmbSum = parseFloat(row.materialNoRmb * row.materialNum).toFixed(2);
row.materialRmbSum = parseFloat(row.materialRmb * row.materialNum).toFixed(2);
}
getTotalAmount()
},
};
$.table.init(options);
});
$(function(){
$.ajax({
type: "post",
url:ctx + "system/customer/customerList",
dataType:"json",
delay:250,
cache:true,
success: function (res, params) {
if (res.rows.length > 0) {
var result = res.rows;
for (let i in result) {
$("#form-salesOrder-edit select[name='enterpriseCode']").append(
"<option value='" + result[i].enterpriseCode + "'>" + result[i].enterpriseCode + "</option>");
}
$("#form-salesOrder-edit select[name='enterpriseCode']").val(sysSalesOrder.enterpriseCode).trigger("change");
} else {
$.modal.msgError(res.msg);
type: "post",
url:ctx + "system/customer/customerList",
dataType:"json",
delay:250,
cache:true,
success: function (res, params) {
if (res.rows.length > 0) {
var result = res.rows;
for (let i in result) {
$("#form-salesOrder-edit select[name='enterpriseCode']").append(
"<option value='" + result[i].enterpriseCode + "'>" + result[i].enterpriseCode + "</option>");
}
},
$("#form-salesOrder-edit select[name='enterpriseCode']").val(sysSalesOrder.enterpriseCode).trigger("change");
} else {
$.modal.msgError(res.msg);
}
},
});
$.ajax({
type: "post",
@ -544,7 +559,7 @@
$("#usd_edit").val(Number(sysSalesOrder.usd).toFixed(2));
$("#noUsdSum_edit").val(Number(sysSalesOrder.noUsdSum).toFixed(2));
$("#usdSum_edit").val(Number(sysSalesOrder.usdSum).toFixed(2));
});
})
$('#enterpriseCode_edit').on('select2:select', function (e) {
var data = e.params.data;
$("input[name='enterpriseName']").val(data.enterpriseName);
@ -580,23 +595,15 @@
function doSubmit(index, layero,uniqueId){
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
console.log("rowData:"+rowData);
var totalNum = $("#bootstrap-select-table").bootstrapTable('getData').length;
var rmb1 = $("#taxRate_edit").val();
if (rmb1 =='' || rmb1== null){
if (rmb1== null){
rmb1 = 0;
}else{
rmb1 = $("#taxRate_edit").val();
}
var rmb = Number(rmb1).toFixed(2) / 100;
var usd = $("#usdTax_edit").val();
if (usd =='' || usd== null){
usd = 0;
}else{
usd = Number(usd).toFixed(2);
}
$("#bootstrap-sub-table-editOrder").bootstrapTable('insertRow', {
index: 1,
var rmb = parseFloat(rmb1).toFixed(2) / 100;
var usd = $("#usdTax_edit").val()!=null?Number(usd).toFixed(2):0;
$("#bootstrap-table-editOrder").bootstrapTable('insertRow', {
index: totalNum,
row: {
id:'',
materialId:rowData.id,
@ -608,7 +615,7 @@
photoUrl: rowData.photoUrl,
unit: rowData.unit,
processMethod: rowData.processMethod,
countTax:rmb1 ,
countTax:rmb ,
usdTax: usd,
materialSole: rowData.materialSole,
materialNum: 0.00,
@ -635,52 +642,35 @@
$.modal.openOptions(options);
}
/* 删除指定表格行 */
function removeRow(index){
$("#bootstrap-sub-table-editOrder").bootstrapTable('remove', {
field: 'index',
value: index
function removeRow(){
var ids = $.table.selectColumns("id");
if (ids.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$("#bootstrap-table-editOrder").bootstrapTable('remove', {
field: 'id',
values: ids
})
}
$("input[name='pricingDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='deliveryTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='orderReceivingTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='modificationTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
function submitHandler() {
if ($.validate.form()) {
var formData = $("#form-salesOrder-edit").serializeArray();
var tableData = $("#bootstrap-sub-table-editOrder").bootstrapTable('getData');
var tableData = $("#bootstrap-table-editOrder").bootstrapTable('getData');
var rows = tableData.length;
if(rows==0){
$.modal.alertWarning("子表数据不能为空!");
}else{
formData.push({"name": "sysSalesOrderChildList", "value": tableData});
var jsonData = $.common.formDataToJson(formData);
console.log("jsonData");
console.log(jsonData);
$.operate.saveJson(prefix + "/edit", jsonData);
}
}
}
//计算
function getTotalAmount(){
// $("#addFinishbomTable").bootstrapTable('refresh');
let getData = $("#bootstrap-sub-table-order").bootstrapTable('getData');
let getData = $("#bootstrap-table-editOrder").bootstrapTable('getData');
let enterprise = 0;let enterpriseSum = 0; let noRmb = 0;
let rmb = 0;let noRmbSum =0;let rmbSum = 0;
let noUsd = 0;let usd = 0;let noUsdSum =0; let usdSum = 0;
@ -696,7 +686,7 @@
$("input[name='usdTaxSum']").val(0);
for(let i=0;i<getData.length;i++){
enterprise += 1;
enterpriseSum = parseInt(enterprise + getData[i].materialNum);
enterpriseSum = parseInt(enterprise + getData[i].materialNum).toFixed(0);
noRmb = parseFloat(noRmb + getData[i].materialNoRmb).toFixed(2);
rmb = parseFloat(rmb + getData[i].materialRmb).toFixed(2) ;
noRmbSum = parseFloat(noRmbSum + getData[i].materialNoRmbSum).toFixed(2);

Loading…
Cancel
Save