首页 > 其他分享 >阿基米德常用方法

阿基米德常用方法

时间:2022-12-14 14:33:41浏览次数:47  
标签:阿基米德 常用 Nkd newlbo Foundation BusinessObjects query QueryObject 方法

一、未解决

1、多选框的使用

二、解决

一、后端

1、多条件查询

from Nkd.Foundation.Common.LogicaxOperator import LogicalOperator
from Nkd.Foundation.Common.FieldOperator import FieldOperator
from Nkd.Foundation.BusinessObjects.QueryObject.Filter import Filter, FilterCollection
 containerStorageBinCollection=ContainerStorageBinCollection()
                    fc = FilterCollection()
                    f = Filter()
                    f.Name = "SourceEntityId"
                    f.Value = i.SourceEntity  # type:ignore
                    f.Operator = FieldOperator.IsEqualTo
                    f.LogicalOperator = LogicalOperator.AND
                    f1 = Filter()
                    f1.Name = "UniversalState"
                    f1.Value = 2  # type:ignore
                    f1.Operator = FieldOperator.IsEqualTo
                    f1.LogicalOperator = LogicalOperator.AND
                    fc.append(f)
                    fc.append(f1)
                    containerStorageBinCollection.LoadByFilter(fc) // 
                    for i in containerStorageBinCollection:
                        containerStorageBin= ContainerStorageBin()
                        containerStorageBin.Id=i.Id
                        containerStorageBin.Load()
                        containerStorageBin.UniversalState = 4
                        containerStorageBin.Save()

2、sql 和Load() 查询

 from Nkd.Foundation.Common.CallContext import CallContextManager
    sql_execute = CallContextManager.GetCurrentCallContext().DbSession
    sql4='''SELECT * from  DataModel_T_ContainerStorageBin'''
    firstresult = sql_execute.execute(sql4)
    firstrows = firstresult.fetchall()
    print('ddd',firstrows)
#Load():                    
containerStorageBin= ContainerStorageBin()
                storageBin=StorageBin()
                storageBin.Name = i.Name.split('/')[1]
                storageBin.Load()                    
                            

sql时间模块

  SELECT DATE_SUB(now(),INTERVAL 1 HOUR) result;
  select  date1  from date where  date(date1)>=DATE_SUB(curdate(),INTERVAL 7 day) 
	                                  and date(date1)<=DATE_SUB(curdate(),INTERVAL 1 HOUR)

查询2021年8月的数据:

where
-- Year(date) ='2021' and month(date)= '8'
-- date_format(date,'%Y-%m')= '2021-08'
-- SUBSTRING_INDEX(date,'-',2)= '2021-08'
SUBSTRING(date,1,7)= '2021-08'
-- LEFT(date,7) ='2021-08'

3、name生成器

#1、不使用变量:
from Nkd.Foundation.BusinessObjects.NameGenerator import NameGenerator
 order_name_generator = NameGenerator()
                order_name_generator.Name = "ContainerStorageBinNameGenerator"
                containerStorageBin.Name = order_name_generator.GenerateName()
#2、使用变量?

4、query

getObjectByNamePort(name):Observable { const executeQueryInput = new newlbo.Nkd.Foundation.BusinessOrchestration.QueryManagement.InputObjects.ExecuteQueryInput; const filterCollection: newlbo.Nkd.Foundation.BusinessObjects.QueryObject.FilterCollection = new newlbo.Nkd.Foundation.BusinessObjects.QueryObject.FilterCollection(); // Filter filter_0 const filter_0: newlbo.Nkd.Foundation.BusinessObjects.QueryObject.Filter = new newlbo.Nkd.Foundation.BusinessObjects.QueryObject.Filter(); filter_0.Name = "Name"; filter_0.ObjectName = "Container"; filter_0.ObjectAlias = "Container"; filter_0.Operator = newlbo.Nkd.Foundation.Common.FieldOperator.IsEqualTo; filter_0.Value = name; filter_0.LogicalOperator = newlbo.Nkd.Foundation.Common.LogicalOperator.Nothing; filter_0.FilterType = newlbo.Nkd.Foundation.BusinessObjects.QueryObject.Enums.FilterType.Normal; filterCollection.push(filter_0) const fieldCollection: newlbo.Nkd.Foundation.BusinessObjects.QueryObject.FieldCollection = new newlbo.Nkd.Foundation.BusinessObjects.QueryObject.FieldCollection(); // Field field_0 const field_0: newlbo.Nkd.Foundation.BusinessObjects.QueryObject.Field = new newlbo.Nkd.Foundation.BusinessObjects.QueryObject.Field(); field_0.Alias = 'ContainerName'; field_0.ObjectName = 'Container'; field_0.ObjectAlias = 'Container'; field_0.IsUserAttribute = false; field_0.Name = 'Name'; field_0.Position = 0; field_0.Sort = newlbo.Nkd.Foundation.Common.FieldSort.NoSort; fieldCollection.push(field_0) const relationCollection: newlbo.Nkd.Foundation.BusinessObjects.QueryObject.RelationCollection = new newlbo.Nkd.Foundation.BusinessObjects.QueryObject.RelationCollection(); const relation_1: newlbo.Nkd.Foundation.BusinessObjects.QueryObject.Relation = new newlbo.Nkd.Foundation.BusinessObjects.QueryObject.Relation(); relation_1.Alias = ""; relation_1.IsRelation = false; relation_1.Name = ""; relation_1.SourceEntity = "Container"; relation_1.SourceEntityAlias = "Container"; relation_1.SourceJoinType = newlbo.Nkd.Foundation.BusinessObjects.QueryObject.Enums.JoinType.LeftJoin; relation_1.SourceProperty = "ContainerId"; relation_1.TargetEntity = "ContainerStorageBin"; relation_1.TargetEntityAlias = "ContainerStorageBin"; relation_1.TargetJoinType = newlbo.Nkd.Foundation.BusinessObjects.QueryObject.Enums.JoinType. LeftJoin; relation_1.TargetProperty = "SourceEntityId"; relationCollection.push(relation_1) const query: newlbo.Nkd.Foundation.BusinessObjects.QueryObject.QueryObject = new newlbo.Nkd.Foundation.BusinessObjects.QueryObject.QueryObject(); query.Description = ""; query.EntityTypeName = "Container"; query.Name = "Container"; query.Query = new newlbo.Nkd.Foundation.BusinessObjects.QueryObject.Query(); query.Query.Distinct = false; query.Query.Filters = filterCollection; query.Query.Fields = fieldCollection; query.Query.Relations = relationCollection; query.Query.Top = 0; executeQueryInput.QueryObject = query; return this.http .post(commonApi.getQueryListApi, executeQueryInput, {}, { headers: new HttpHeaders({}) })
### 5、端口占用
一、问题:OSError: [Errno 98] Address already in use
解决:sudo lsof -i:(port) 
 	 sudo kill (PID)

6、git步骤:

git init 
git status
git pull
git add Nkd/Custom
git add Tools/MasterDataBuilder/MasterData/CustomData
后段上传这两个文件夹:
Nkd/Custom
Tools/MasterDataBuilder/MasterData/CustomData

image

二、前端

1、接口传值

 updateWarehouseLocation(date,i): Observable<any> {
        const ContainerStorageBinDateInput = new newlbo.Nkd.Custom.BusinessOrchestration.ScaleboardQueryManagement.InputObjects.UpdateWarehouseLocationInput
        const ContainerStorageBinCollection =new newlbo. Nkd.Venus.BusinessObjects.ContainerStorageBinCollection()
        date.forEach(item=>{
            const ContainerStorageBin = new newlbo.Nkd.Venus.BusinessObjects.ContainerStorageBin()
            ContainerStorageBin.Name = item.ContainerName+'/'+item.newWarehouseLocation
            ContainerStorageBin.SourceEntity= item.ContainerId
            ContainerStorageBin.TargetEntity = item.StorageBinId
            // ContainerName: 'M1E1H22XX001', StorageBinName: 'N201-1-01', ContainerId: '1555024017411411968', StorageBinId: '1554280608778293248'
            ContainerStorageBinCollection.push(ContainerStorageBin)
        })
        ContainerStorageBinDateInput.ContainerStorageBin=ContainerStorageBinCollection
        ContainerStorageBinDateInput.flag = i;
        const ContainerStorageBinDateInputStr = newlbo.LboJson.stringify(ContainerStorageBinDateInput);
        return this.http
            .post(containerApi.UpdateWarehouseLocationApi,JSON.parse(ContainerStorageBinDateInputStr), {}, {});
    }

2、对话框

 this.modal.confirm({
                            nzTitle: '<i>您确定执行绑定操作吗?</i>',
                            // nzContent: '<b>Some descriptions</b>',
                            nzOnOk: () => {
                                console.log(this.ContainerList);
                                this.updatedata(e);
                            }
                        });
                        
刷新表单:
import { Component, OnInit, ViewChild } from '@angular/core';
import { STColumn, STChange, ReuseTabService, STComponent, STColumnBadge } from '@delon/abc';
export class ScaleboardQueryComponent implements OnInit {
    @ViewChild('st', { static: false }) private st: STComponent;
 this.st.reload();  
 
  columns: STColumn[] = [
        { title: '序号', index: '', width: '1%' },
        { title: '托盘号', index: 'name', width: '5%' },
        { title: '现有库位号', index: 'oldFacilityId', width: '8%' },
        { title: '新绑定库位号', index: 'newFacilityId', width: '5%' },]

html:
st标签:
  <st #st [data]="" [columns]="columns_Container" [ps]="5" [scroll]="{x:'100%'}"
                [widthMode]="{type:'strict',strictBehavior:'warp'}" size="small" bordered="true"
                [page]="{ front: true, show: true, showSize: true, pageSizes: [5,10,20,50,100] }">
 </st>

3、帆软-打印

const url = FineReportApi.FineReportIp;  // 帆软IP
                console.log('打印批次号:',materialNameList);
                window.open(url + '/webroot/decision/view/report?viewlet=archimedes%252Fprint-晶圆绷膜标签.cpt' + '&批次号=' + materialNameList)
                this.message.success(res.MESSAGE)

4、导出

1.ng-alain:Excel 操作

2.阿基米徳:query-management->product-defect-query
 // 导出
  <st #st1 [data]="ContainerStorageBinList" [columns]="columns_Container" [ps]="5" [scroll]="{x:'100%'}"
                [widthMode]="{type:'strict',strictBehavior:'warp'}" size="small" bordered="true"
                [page]="{ front: true, show: true, showSize: true, pageSizes: [5,10,20,50,100] }">
 </st>
            
@ViewChild('st1', { static: false }) private st1: STComponent; 
 
if(this.ContainerStorageBinList.length!==0){
            console.log('ContainerStorageBinList',this.ContainerStorageBinList);
            this.st1.export(this.ContainerStorageBinList, {filename: '托盘绑定信息.xlsx', sheetname: '托盘绑定信息'});
            
        }

5、表格下方添加一行总计

image

  <st #st [data]="data" [columns]="columns" [body]="bodyTpl">
      <ng-template #bodyTpl let-s>
        <ng-container *ngIf="st.count > 0">
          <tr>
            <td>合计</td>
            <td>{{ s.len.text }} 个</td>
            <td>{{ s.dc.text }}</td>
            <td class="text-right">{{ s.sum.text }}</td>
            <td class="text-right">{{ s.avg.text }}</td>
            <td class="text-right">{{ s.min.text }}</td>
            <td class="text-right">{{ s.max.text }}</td>
            <td class="text-right">{{ s.custom.text }}</td>
          </tr>
          <tr class="bg-grey-lighter">
            <td colspan="3">性别平均值</td>
            <td class="text-right">{{ s.sum.value / s.len.value | price }}</td>
            <td colspan="4"></td>
          </tr>
        </ng-container>
      </ng-template>
    </st>
 [columns]="columns":
    { title: 'Min', index: 'price', type: 'currency', statistical: 'min', key: 'min' },
    { title: 'Max', index: 'price', type: 'currency', statistical: 'max', key: 'max' },
    {
      title: 'Custom',
      index: 'price',
      type: 'currency',
      statistical: { type: values => ({ value: values[0], text: `**${values[0]}` }), currency: false },
      key: 'custom',
    }

标签:阿基米德,常用,Nkd,newlbo,Foundation,BusinessObjects,query,QueryObject,方法
From: https://www.cnblogs.com/relap-li/p/16982019.html

相关文章