Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js
===================================================================
diff -u -r14271 -r14328
--- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js (.../goodsTemplateApplicationView.js) (revision 14271)
+++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js (.../goodsTemplateApplicationView.js) (revision 14328)
@@ -43,6 +43,7 @@
obj.name = children[i].get('name');
obj.count = children[i].get('count');
+ // obj.urgentAmount = children[i].get('urgentAmount');
obj.tousseType = children[i].get('tousseType');
obj.groupNum = children[i].get('groupNum');
if(obj.count <= 0){
@@ -274,6 +275,7 @@
{name : 'packageSpec',mapping : 'packageSpec'},
{name : 'unit',mapping : 'unit'},
{name : 'amount',mapping : 'amount'},
+ {name : 'urgentAmount',mapping : 'urgentAmount'},
{name : 'materials',mapping : 'materials'},
{name : 'minApplyAmount',mapping : 'minApplyAmount'},
{name : 'maxApplyAmount',mapping : 'maxApplyAmount'}
@@ -326,6 +328,7 @@
{name : 'displayName',mapping : 'displayName'},
{name : 'minApplyAmount',mapping : 'minApplyAmount'},
{name : 'maxApplyAmount',mapping : 'maxApplyAmount'},
+ {name : 'urgentAmount',mapping : 'urgentAmount'},
{name : 'unit',mapping : 'unit'},
{name : 'price',mapping : 'price'},
{name : 'amount',mapping : 'amount'}]
@@ -338,6 +341,7 @@
{name : 'id'},
{name : 'name'},
{name : 'count'},
+ {name : 'urgentAmount'},
{name : 'minApplyAmount'},
{name : 'maxApplyAmount'},
{name : 'diposable'},
@@ -364,6 +368,7 @@
{name : 'id'},
{name : 'name'},
{name : 'count'},
+ {name : 'urgentAmount'},
{name : 'price'},
{name : 'status'},
{name : 'hasReturnedNum'},
@@ -423,6 +428,7 @@
{name : 'storage'},
{name : 'unit'},
{name : 'materials'},
+ {name : 'urgentAmount'},
{name : 'children'}
]});
@@ -536,14 +542,18 @@
return foundNode;
}
-function updateNode(treegrid, foundNode, count, price){
+function updateNode(treegrid, foundNode, count, price,urgentAmount){
var targetNode = foundNode;
+ targetNode.set('urgentAmount', urgentAmount);
// 如果节点是消毒物品,并且不是整包清洗,则更新其子节点(材料)的数量
if (!targetNode.get('leaf') && targetNode.get('isApplyEntireTousse') != '是'){
+ //在父节点被子节点覆盖前先把urgentAmount清空
var childNodes = targetNode.childNodes;
if (childNodes != null && childNodes.length > 0){
targetNode = childNodes[0];
+ //保留父节点的值,清空子节点的值
+ targetNode.set('urgentAmount', '');
}
}
@@ -555,17 +565,17 @@
}
//TODO 5 取消科室申请模板
-function addItems(tousseDefinitionID,name,count,diposable,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount){
+function addItems(tousseDefinitionID,name,count,diposable,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount){
var foundNode = null;
if('是' == diposable){
foundNode = getExsistNode(rightTemplateStore, name);
if (foundNode != null){
- updateNode('diposableTreeGrid', foundNode, count, price);
+ updateNode('diposableTreeGrid', foundNode, count, price,urgentAmount);
}
}else{
foundNode = getExsistNodeByTousseDefinitionID(leftTemplateStore, tousseDefinitionID);
if (foundNode != null){
- updateNode('tousseTreeGrid', foundNode, count, price);
+ updateNode('tousseTreeGrid', foundNode, count, price,urgentAmount);
if(tousseType == tousseType_disinfectGoods){
updateDisinfectParentNode(foundNode);
updateDisinfectGoodsChildNodes(foundNode);
@@ -594,6 +604,7 @@
children : materials,
minApplyAmount : minApplyAmount,
maxApplyAmount : maxApplyAmount,
+ urgentAmount : urgentAmount,
totalPrice:roundValue(price*count),
packageSpec:packageSpec
});
@@ -616,6 +627,7 @@
tousseDefinitionID: tousseDefinitionID,
name : name,
count : pacakgeCount,
+ urgentAmount : urgentAmount,
diposable : diposable,
tousseType : tousseType,
isApplyEntireTousse : isApplyEntireTousse,
@@ -637,7 +649,7 @@
}
if(top.Ext4.getCmp('isDiposableGoods').getValue()=="否"){
var appendNode = leftTemplateStore.getRootNode().appendChild(tousseInstance);
- updateNode('tousseTreeGrid', appendNode, count, price);
+ updateNode('tousseTreeGrid', appendNode, count, price,urgentAmount,urgentAmount);
if(tousseType == tousseType_disinfectGoods){
updateDisinfectParentNode(appendNode);
}
@@ -727,6 +739,7 @@
var count = top.Ext4.getCmp('count1').getValue();
var tousseType = top.Ext4.getCmp('tousseType').getValue();
var materials = top.Ext4.getCmp('materials').getValue();
+ var urgentAmount = top.Ext4.getCmp('urgentAmount').getValue();
var price = top.Ext4.getCmp('price').getValue();
var externalCode = isDiposableGoods == '是' ?top.Ext4.getCmp('externalCode').getValue() : '';
@@ -769,19 +782,20 @@
}
});
}
- else if(count > maxApplyAmount && maxApplyAmount != ""){
+ else if(!isUndefinedOrNullOrEmpty(maxApplyAmount) && count > maxApplyAmount){
top.Ext4.Msg.alert("提示消息","申请数量大于最大可申请数量");
//showResult("申请数量大于最大可申请数量");
clearCount();
- addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount);
+ addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount);
}
else{
- addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount);
+ addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount);
}
}else{
- addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount);
+ addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount);
}
+ top.Ext4.getCmp('urgentAmount').setValue('');
top.Ext4.getCmp('diposableGoodsAmount').setValue('');
top.Ext4.getCmp('minApplyAmount').setValue('');
top.Ext4.getCmp('maxApplyAmount').setValue('');
@@ -894,6 +908,7 @@
obj.totalPrice = node.get("totalPrice");
obj.tousseType = node.get("tousseType");
obj.externalCode = node.get("externalCode");
+ obj.urgentAmount = node.get("urgentAmount");
// 普通物品
if (node.get("leaf") == true){
obj.spec = "";
@@ -935,7 +950,8 @@
tr += "
序号 | ";
tr += "名称 | ";
tr += "数量 | ";
- tr += "规格 | ";
+ tr += "加急数量 | ";
+ tr += "规格 | ";
tr += "单位 | ";
tr += "";
table += tr;
@@ -945,6 +961,7 @@
tr += "" + ( i + 1 ) + " | ";
tr += "" + array[i].name + " | ";
tr += "" + array[i].count + " | ";
+ tr += "" + array[i].urgentAmount + " | ";
tr += "" + array[i].spec + " | ";
tr += "" + array[i].unit + " | ";
tr += "";
@@ -1358,6 +1375,18 @@
maxValue: 9999
}
},{
+ header : "加急数量",
+ dataIndex : 'urgentAmount',
+ width : 62,
+ hidden : false,
+ editor: {
+ xtype: 'numberfield',
+ allowBlank: true,
+ allowDecimals :false,
+ minValue: 0,
+ maxValue: 9999
+ }
+ },{
header : "单位",
dataIndex : 'unit',
width : 45,
@@ -1412,14 +1441,26 @@
maxValue: 9999
}
},{
+ header : "加急数量",
+ dataIndex : 'urgentAmount',
+ width : 62,
+ hidden : false,
+ editor: {
+ xtype: 'numberfield',
+ allowBlank: true,
+ allowDecimals :false,
+ minValue: 0,
+ maxValue: 9999
+ }
+ },{
header : "单位",
dataIndex : 'unit',
- width : 55,
+ width : 45,
hidden:type=='器械包申请单'?true:false,
menuDisabled : true
},{
header : "单价",
- width : 55,
+ width : 48,
dataIndex : 'price',
hidden : sstsConfig.hideDisposablePriceColumn,
align:'right',
@@ -1495,7 +1536,7 @@
var record = context.record;
var depth = record.getDepth();
var isLeaf = record.get('leaf');
-
+
if (hiddenCommitButton){
return false;
}
@@ -1506,8 +1547,8 @@
}
// 点击消毒物品包数量的单元格
else{
- // 是整包清洗
- if (record.get('isApplyEntireTousse') == "是"){
+ // 是整包清洗或者编辑项为加急数量时允许编辑
+ if (record.get('isApplyEntireTousse') == "是" || 'urgentAmount' == context.field){
return true;
}
else{
@@ -1537,20 +1578,43 @@
var maxApplyAmount = record.get("maxApplyAmount");
if (isDiposableGoods == '是' && context.value != null && context.value != ''){
- var storage = record.get("storage");
- if(parseInt(context.value,10) > storage && !allowApplyDisposableGoodsWhenUnderstock){
- showResult("申请数量不能大于库存数量!");
- record.set("count", "");
+ if ("urgentAmount" != context.field){
+ var storage = record.get("storage");
+ if(parseInt(context.value,10) > storage && !allowApplyDisposableGoodsWhenUnderstock){
+ showResult("申请数量不能大于库存数量!");
+ record.set("count", "");
+ }
+ if (!isValidDiposableAmount(minApplyAmount,context.value)){
+ showResult("该一次性物品最小申请数量为"+minApplyAmount+",所填数量必须是"+minApplyAmount+"的倍数。");
+ record.set("count", "");
+ }
+ if (!isUndefinedOrNullOrEmpty(maxApplyAmount) && maxApplyAmount < context.value){
+ top.Ext4.Msg.alert("提示消息","申请数量大于最大可申请数量");
+ }
}
- if (!isValidDiposableAmount(minApplyAmount,context.value)){
- showResult("该一次性物品最小申请数量为"+minApplyAmount+",所填数量必须是"+minApplyAmount+"的倍数。");
- record.set("count", "");
+ }
+
+ var depth = record.getDepth();
+ var isLeaf = record.get('leaf');
+ var tousseType = record.get('tousseType');
+ var isApplyEntireTousse = record.get('isApplyEntireTousse');
+ var urgentAmount = record.get('urgentAmount');
+
+ //如果是清洗包拆包编辑的是第一层的时候只需要判断加急数量是否大于1,因为拆包的数量不能编辑
+ if (!isLeaf && depth == 1 && isApplyEntireTousse == '否'){
+ if (handleUrgentAmount.handleApplyEntireTousse(tousseType,isApplyEntireTousse,urgentAmount)){
+ record.set("urgentAmount", "");
}
- if (maxApplyAmount < context.value){
- top.Ext4.Msg.alert("提示消息","申请数量大于最大可申请数量");
+ }
+ else{
+ if (handleUrgentAmount.handleUaAndCount(urgentAmount,record.get('count'))){
+ record.set("urgentAmount", "");
}
+ if (handleUrgentAmount.handleApplyEntireTousse(tousseType,isApplyEntireTousse,urgentAmount)){
+ record.set("urgentAmount", "");
+ }
}
-
+
record.set("totalPrice", roundValue(context.value * record.get("price")));
if (context.value == 0){
record.set("count", "");
@@ -1577,6 +1641,26 @@
}
});
+
+ var handleUrgentAmount = {
+ //判断加急数量是否大于申请数量
+ handleUaAndCount: function (urgentAmount,count) {
+ if (count < urgentAmount){
+ showResult("加急数量不能大于申请数量!");
+ return true;
+ }
+ return false;
+ },
+ //判断消毒物品不拆包加急数量是否大于1
+ handleApplyEntireTousse: function (tousseType,isApplyEntireTousse,urgentAmount) {
+ if (tousseType == '消毒物品' && isApplyEntireTousse == '否' && urgentAmount > 1){
+ showResult("消毒物品拆包清洗加急数量不能大于1!");
+ return true;
+ }
+ return false;
+ }
+ }
+
var handleCount = {
// 左边的,如果这次遍历没找到tousseDefinitionID相同,则旧数据当成是新数据插入
handleLeft: function(cache,newData,flag){
@@ -1588,11 +1672,13 @@
Ext.each(i.children,function (leaf) {
if (cacheLeaf.get('name') == leaf.name){
leaf.count = cacheLeaf.get('count');
+ leaf.urgentAmount = cacheLeaf.get('urgentAmount');
}
});
});
}
i.count = cache.count;
+ i.urgentAmount = cache.urgentAmount;
flag = false;
}
});
@@ -1603,6 +1689,7 @@
Ext.each(newData,function (i) {
if(cache.externalCode == i.externalCode){
i.count = cache.count;
+ i.urgentAmount = cache.urgentAmount;
flag = false;
}
});
@@ -2148,6 +2235,30 @@
}
}
},{
+ text:"加急数量:"
+ },{
+ xtype : 'numberfield',
+ id : 'urgentAmount',
+ name : 'urgentAmount',
+ style : 'text-align: left',
+ width : 60,
+ maxValue: 9999,
+ minValue: 1,
+ allowNegative : false,
+ allowDecimals : false,
+ listeners : {
+ specialkey : function(field, ee) {
+ if (ee.getKey() == Ext.EventObject.ENTER) {
+ if(Ext.isEmpty(field.getValue())||field.getValue()<=0){
+ showResult("加急数量必须大于0");
+ field.focus();
+ return false;
+ }
+ addRecyclingApplicationItem();
+ }
+ }
+ }
+ },{
xtype:'button',
id : 'addTousseBt',
iconCls : 'btn_ext_add',
@@ -2158,6 +2269,18 @@
count.focus();
return ;
}
+ var urgentAmount = top.Ext4.getCmp('urgentAmount');
+ if (handleUrgentAmount.handleUaAndCount(urgentAmount.getValue(),count.getValue())){
+ urgentAmount.focus();
+ return ;
+ }
+
+ var tousseType = top.Ext4.getCmp('tousseType').getValue();
+ var isApplyEntireTousse = top.Ext4.getCmp('isApplyEntireTousse').getValue();
+ if (handleUrgentAmount.handleApplyEntireTousse(tousseType,isApplyEntireTousse,urgentAmount.getValue())){
+ urgentAmount.focus();
+ return ;
+ }
addRecyclingApplicationItem();
}
},{
@@ -2212,7 +2335,7 @@
id: 'unitInfoDisplayField',
name: 'unitInfoDisplayField',
value: ''
- }
+ }
]
})
]
@@ -2311,7 +2434,9 @@
var applyAmount = n.get('count');
var price = stringToFloat(n.get('price') + "");
var totalPrice = stringToFloat(n.get('totalPrice') + "");
-
+ var urgentAmount = n.get('urgentAmount');
+ var isApplyEntireTousse = n.get('isApplyEntireTousse');
+
tousseNames += n.get('name') + ";";
var tousseType = n.get('tousseType');
var unit = n.get('unit');
@@ -2322,14 +2447,24 @@
if (tousseType == tousseType_disinfectGoods && n.get('isApplyEntireTousse') != '是'){
applyAmount = 1;
var materialNodes = n.childNodes;
+ //如果不是整包申请,urgentAmount大于一的时候,最高取值变成1
+ if (urgentAmount > 1){
+ urgentAmount = 1;
+ }
+ // urgentAmount = materialNodes[0].get('urgentAmount');
totalPrice = 0;
for (var j=0; j